Compare commits
1 Commits
WIDGET_IDL
...
tags/STABL
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e47a46b213 |
BIN
mozilla/webtools/tinderbox/1afi003r.gif
Normal file
BIN
mozilla/webtools/tinderbox/1afi003r.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
216
mozilla/webtools/tinderbox/Backwards.pm
Normal file
216
mozilla/webtools/tinderbox/Backwards.pm
Normal file
@@ -0,0 +1,216 @@
|
||||
# Backwards.pm
|
||||
|
||||
# Copyright (C) 1999 Uri Guttman. All rights reserved.
|
||||
# mail bugs, comments and feedback to uri@sysarch.com
|
||||
|
||||
|
||||
use strict ;
|
||||
|
||||
package Backwards ;
|
||||
|
||||
use Symbol ;
|
||||
use Fcntl ;
|
||||
use Carp ;
|
||||
use integer ;
|
||||
|
||||
#my $max_read_size = 3 ;
|
||||
|
||||
my $max_read_size = 1 << 13 ;
|
||||
|
||||
# support tied handles. the tied calls map directly to the object methods
|
||||
|
||||
*TIEHANDLE = \&new ;
|
||||
*READLINE = \&readline ;
|
||||
|
||||
# create a new Backwards object
|
||||
|
||||
sub new {
|
||||
|
||||
my( $class, $filename ) = @_ ;
|
||||
|
||||
my( $handle, $seek_pos, $read_size, $self ) ;
|
||||
|
||||
# get a new handle symbol and the real file handle
|
||||
|
||||
$handle = gensym() ;
|
||||
|
||||
# open the file for reading
|
||||
|
||||
unless( sysopen( $handle, $filename, O_RDONLY ) ) {
|
||||
carp "Can't open $filename $!" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
# seek to the end of the file
|
||||
|
||||
seek( $handle, 0, 2 ) ;
|
||||
$seek_pos = tell( $handle ) ;
|
||||
|
||||
# get the size of the first block to read,
|
||||
# either a trailing partial one (the % size) or full sized one (max read size)
|
||||
|
||||
$read_size = $seek_pos % $max_read_size || $max_read_size ;
|
||||
|
||||
# create the hash for the object, bless and return it
|
||||
|
||||
$self = {
|
||||
'file_name' => $filename,
|
||||
'handle' => $handle,
|
||||
'read_size' => $read_size,
|
||||
'seek_pos' => $seek_pos,
|
||||
'lines' => [],
|
||||
} ;
|
||||
|
||||
return( bless( $self, $class ) ) ;
|
||||
}
|
||||
|
||||
sub readline {
|
||||
|
||||
my( $self, $line_ref ) = @_ ;
|
||||
|
||||
my( $handle, $lines_ref, $seek_pos, $read_cnt, $read_buf,
|
||||
$file_size, $read_size, $text ) ;
|
||||
|
||||
# get the buffer of lines
|
||||
|
||||
$lines_ref = $self->{'lines'} ;
|
||||
|
||||
while( 1 ) {
|
||||
|
||||
# see if there is more than 1 line in the buffer
|
||||
|
||||
if ( @{$lines_ref} > 1 ) {
|
||||
|
||||
# we have a complete line so return it
|
||||
|
||||
return( pop @{$lines_ref} ) ;
|
||||
}
|
||||
|
||||
# we don't have a complete, so have to read blocks until we do
|
||||
|
||||
$seek_pos = $self->{'seek_pos'} ;
|
||||
|
||||
# see if we are at the beginning of the file
|
||||
|
||||
if ( $seek_pos == 0 ) {
|
||||
|
||||
# the last read never made more lines, so return the last line in the buffer
|
||||
# if no lines left then undef will be returned
|
||||
|
||||
return( pop @{$lines_ref} ) ;
|
||||
}
|
||||
|
||||
#print "c size $read_size\n" ;
|
||||
|
||||
# we have to read more text so get the handle and the current read size
|
||||
|
||||
$handle = $self->{'handle'} ;
|
||||
$read_size = $self->{'read_size'} ;
|
||||
|
||||
# after the first read, always read the maximum size
|
||||
|
||||
$self->{'read_size'} = $max_read_size ;
|
||||
|
||||
# seek to the beginning of this block and save the new seek position
|
||||
|
||||
$seek_pos -= $read_size ;
|
||||
$self->{'seek_pos'} = $seek_pos ;
|
||||
seek( $handle, $seek_pos, 0 ) ;
|
||||
|
||||
#print "seek $seek_pos\n" ;
|
||||
|
||||
# read in the next (previous) block of text
|
||||
|
||||
$read_cnt = sysread( $handle, $read_buf, $read_size ) ;
|
||||
|
||||
#print "Read <$read_buf>\n" ;
|
||||
|
||||
# if ( $read_cnt != $read_size ) {
|
||||
# print "bad read cnt $read_cnt != size $read_size\n" ;
|
||||
# return( undef ) ;
|
||||
# }
|
||||
|
||||
# prepend the read buffer to the leftover (possibly partial) line
|
||||
|
||||
$text = $read_buf . ( pop @{$lines_ref} || '' ) ;
|
||||
|
||||
# split the buffer into a list of lines
|
||||
# this may want to be $/ but reading files backwards assumes plain text and
|
||||
# newline separators
|
||||
|
||||
@{$lines_ref} = $text =~ m[(^.*\n|^.+)]mg ;
|
||||
|
||||
#print "Lines \n=>", join( "<=\n=>", @{$lines_ref} ), "<=\n" ;
|
||||
}
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Backwards.pm -- Read a file backwards by lines.
|
||||
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Backwards ;
|
||||
|
||||
# Object interface
|
||||
|
||||
$bw = Backwards->new( 'log_file' ) ;
|
||||
|
||||
while( $log_line = $bw->readline ) {
|
||||
print $log_line ;
|
||||
}
|
||||
|
||||
# Tied Handle Interface
|
||||
|
||||
tie *BW, 'log_file' ;
|
||||
|
||||
while( <BW> ) {
|
||||
print ;
|
||||
}
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
||||
This module reads a file backwards line by line. It is simple to use,
|
||||
memory efficient and fast. It supports both an object and a tied handle
|
||||
interface.
|
||||
|
||||
It is intended for processing log and other similar text files which
|
||||
typically have new entries appended. It uses newline as the separator
|
||||
and not $/ since it is only meant to be used for text.
|
||||
|
||||
It works by reading large (8kb) blocks of text from the end of the file,
|
||||
splits them on newlines and stores the other lines until the buffer runs
|
||||
out. Then it seeks to the previous block and splits it. When it reaches
|
||||
the beginning of the file, it stops reading more blocks. All boundary
|
||||
conditions are handled correctly. If there is a trailing partial line
|
||||
(no newline) it will be the first line returned. Lines larger than the
|
||||
read buffer size are ok.
|
||||
|
||||
=head2 Object Interface
|
||||
|
||||
|
||||
There are only 2 methods in Backwards' object interface, new and
|
||||
readline.
|
||||
|
||||
=head2 new
|
||||
|
||||
New takes just a filename for an argument and it either returns the
|
||||
object on a successful open on that file or undef.
|
||||
|
||||
=head2 readline
|
||||
|
||||
Readline takes no arguments and it returns the previous line in the file
|
||||
or undef when there are no more lines in the file.
|
||||
|
||||
|
||||
=head2 Tied Handle Interface
|
||||
|
||||
The only tied handle calls supported are TIEHANDLE and READLINE and they
|
||||
are typeglobbed to new and readline respectively. All other tied handle
|
||||
operations will generate an unknown method error. Do not seek, write or
|
||||
do any other operation other than <> on the handle.
|
||||
1
mozilla/webtools/tinderbox/Empty.html
Normal file
1
mozilla/webtools/tinderbox/Empty.html
Normal file
@@ -0,0 +1 @@
|
||||
<font size=+2>Click on the <b>filename and line number</b> in the log and the source will appear in this window.</font>
|
||||
77
mozilla/webtools/tinderbox/Makefile
Executable file
77
mozilla/webtools/tinderbox/Makefile
Executable file
@@ -0,0 +1,77 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
|
||||
# This Makefile helps you install Tinderbox. Define PERL and MYSQLTCL to
|
||||
# the full pathnames of where you have these utilities. Define PREFIX
|
||||
# to where you will install the running Tinderbox. Then "make install" should
|
||||
# copy things for you.
|
||||
|
||||
#BONSAI = /home/httpd/html/bonsai
|
||||
#CVSROOT = /cvsroot
|
||||
#GZIP = /usr/bin/gzip
|
||||
#PERL = /usr/bin/perl
|
||||
#PREFIX = /home/httpd/html/tinderbox
|
||||
#UUDECODE = /usr/bin/uudecode
|
||||
|
||||
FILES = addimage.cgi \
|
||||
addnote.cgi \
|
||||
admintree.cgi \
|
||||
buildwho.pl \
|
||||
clean.pl \
|
||||
copydata.pl \
|
||||
doadmin.cgi \
|
||||
ep_mac.pl \
|
||||
ep_unix.pl \
|
||||
ep_windows.pl \
|
||||
fixupimages.pl \
|
||||
globals.pl \
|
||||
handlemail.pl \
|
||||
imagelog.pl \
|
||||
processbuild.pl \
|
||||
showbuilds.cgi \
|
||||
showimages.cgi \
|
||||
showlog.cgi \
|
||||
Empty.html \
|
||||
faq.html \
|
||||
index.html \
|
||||
examples/mozilla-unix.pl \
|
||||
examples/mozilla-windows.pl
|
||||
|
||||
PICS = \
|
||||
1afi003r.gif \
|
||||
reledanim.gif \
|
||||
star.gif
|
||||
|
||||
install:
|
||||
mkdir -p $(PREFIX) && \
|
||||
for I in $(FILES); do \
|
||||
echo Installing $$I && \
|
||||
sed -e s#/usr/bonsaitools/bin/perl#$(PERL)#g \
|
||||
-e s#/tools/ns/bin/perl5#$(PERL)#g \
|
||||
-e s#/m/src#$(CVSROOT)#g \
|
||||
-e s#/usr/local/bin/gzip#$(GZIP)#g \
|
||||
-e s#/tools/ns/bin/uudecode#$(UUDECODE)#g \
|
||||
-e s#/d/webdocs/projects/bonsai#$(BONSAI)#g \
|
||||
$$I > $(PREFIX)/$$I && \
|
||||
chmod 755 $(PREFIX)/$$I; done && \
|
||||
for I in $(PICS); do \
|
||||
echo Installing $$I && \
|
||||
cp -f $$I $(PREFIX) && \
|
||||
chmod 755 $(PREFIX)/$$I; done
|
||||
|
||||
287
mozilla/webtools/tinderbox/README
Normal file
287
mozilla/webtools/tinderbox/README
Normal file
@@ -0,0 +1,287 @@
|
||||
This is Tinderbox. See <http://www.mozilla.org/tinderbox.html>.
|
||||
|
||||
|
||||
==========
|
||||
DISCLAIMER
|
||||
==========
|
||||
|
||||
This is not very well packaged code. It's not packaged at all. Don't
|
||||
come here expecting something you plop in a directory, twiddle a few
|
||||
things, and you're off and using it. Much work has to be done to get
|
||||
there. We'd like to get there, but it wasn't clear when that would be,
|
||||
and so we decided to let people see it first.
|
||||
|
||||
Don't believe for a minute that you can use this stuff without first
|
||||
understanding most of the code.
|
||||
|
||||
|
||||
============
|
||||
DEPENDENCIES
|
||||
============
|
||||
|
||||
To use tinderbox, you must first have bonsai up and running.
|
||||
See <http://www.mozilla.org/bonsai.html>.
|
||||
|
||||
Be warned now that bonsai is not easily installed.
|
||||
|
||||
|
||||
====================================
|
||||
What's What in the Tinderbox sources:
|
||||
====================================
|
||||
|
||||
This is a rough first pass at cataloging and documenting the Tinderbox
|
||||
sources. Many hands have been in this code over the years, and it has
|
||||
accreted wildly. There is probably quite a lot of dead code in here.
|
||||
|
||||
|
||||
PROGRAMS
|
||||
========
|
||||
|
||||
handlemail.pl This is the mail deliverty agent (MDA) for tinderbox,
|
||||
the local message transfer agent (MTA) calls this
|
||||
program to deliver the tinderbox mail into the system.
|
||||
It is a wrapper for processbuild.pl.
|
||||
|
||||
processbuild.pl Update the "$tbx{tree}/build.dat" database as new
|
||||
mail comes in then run "./buildwho.pl $tree" and
|
||||
"./showbuilds.cgi" (to build static versions of
|
||||
tinderbox data.
|
||||
|
||||
buildwho.pl Update the who.dat file with the list of authors who
|
||||
checked in in the last two days. This is run from
|
||||
processbuild.pl, always, and from showbuild.cgi when
|
||||
'rebuildguilty' is clicked
|
||||
|
||||
|
||||
Conceptually, the three programs, handlemail.pl, processbuild.pl, and
|
||||
buildwho.pl, make up the MDA for tinderbox.
|
||||
|
||||
|
||||
showbuilds.cgi Create the Tinderbox web page.
|
||||
|
||||
showlog.cgi Show a build log (brief and full) update the brief_log if
|
||||
necessary. Requires the ep_$form{errorparser}.pl error
|
||||
parser.
|
||||
|
||||
ep_unix.pl Knows how to parse Unix build error logs. Used by
|
||||
processbuild.pl There needs to be one ep_* file for
|
||||
each distinct parsing algorithm used, typically this
|
||||
is per platform. This file defines the regular
|
||||
expressions which locate error lines: has_error()
|
||||
has_warning() and the function has_errorline() which
|
||||
parses the line into the global variables:
|
||||
$error_file, $error_file_ref, $error_line, $error_guess,
|
||||
|
||||
admintree.cgi Displays the admin cgi which depends on:
|
||||
$message_of_day, $ignore_builds
|
||||
|
||||
doadmin.cgi Actually do the work to admin a tinderbox tree
|
||||
(change message of the day, turn off displays for a
|
||||
channel)
|
||||
|
||||
clean.pl Run `find . -name \"*.gz\" -mtime +7 -print ` and
|
||||
unlink those files. Does not appear to be run from
|
||||
other tools. It is a good candidate for a cron job.
|
||||
|
||||
|
||||
|
||||
OPTIONS to showbuilds.cgi
|
||||
=========================
|
||||
|
||||
Options to showbuilds are specified in the URL and are undocumented
|
||||
elsewhere.
|
||||
|
||||
If called with no 'tree' option display the possible build trees to
|
||||
pick from. The 'tree' picks the build to display. An additional tree
|
||||
can be specified with 'tree2'.
|
||||
|
||||
Interesting visual params are:
|
||||
|
||||
current state monitoring mode:
|
||||
express=1
|
||||
or
|
||||
panel=1
|
||||
text mode state monitoring:
|
||||
quickparse=1
|
||||
|
||||
These modes do not show on my browser:
|
||||
flash=1
|
||||
rdf=1
|
||||
static=1
|
||||
|
||||
These are self explanatory:
|
||||
nocrap=1;
|
||||
hours=n;
|
||||
|
||||
|
||||
EMAIL FORMAT
|
||||
============
|
||||
|
||||
Each tinderbox client mails status updates to the tinderbox server.
|
||||
These mails contain special tinderbox data lines describing the
|
||||
progress of the build it may also contain the log of the build process
|
||||
and could contain a uuencoded binary.
|
||||
|
||||
|
||||
The email to the tinderbox server looks like:
|
||||
|
||||
tinderbox: tree: Mozilla
|
||||
tinderbox: builddate: 900002087
|
||||
tinderbox: status: building
|
||||
tinderbox: build: IRIX 6.3 Depend
|
||||
tinderbox: errorparser: unix
|
||||
|
||||
If binaryname is set then the mail message is run through uudecode to
|
||||
create a file called "$binaryname" on the tinderbox server.
|
||||
|
||||
# NOT USED tinderbox: buildfamily: unix
|
||||
|
||||
|
||||
DATA STRUCTURES IN showbuilds.cgi
|
||||
=================================
|
||||
|
||||
load_buildlog() creates build_list a list of hash refernces of this
|
||||
type
|
||||
$buildrec = {
|
||||
mailtime => $mailtime,
|
||||
buildtime => $buildtime,
|
||||
buildname => ($tree2 ne '' ? $t->{name} . ' ' : '' ) . $buildname,
|
||||
errorparser => $errorparser,
|
||||
buildstatus => $buildstatus,
|
||||
logfile => $logfile,
|
||||
binaryname => $binaryname,
|
||||
td => $t
|
||||
};
|
||||
|
||||
the $buildrec->{rowspan} variable holds the number of rows that the build
|
||||
should occupy on the table and is not stored in the build.dat file.
|
||||
|
||||
These are other add ons to the data structure
|
||||
$buildrec->{hasnote}=1;
|
||||
$buildrec->{noteid} = (0+@note_array);
|
||||
|
||||
commonly buildrec's are accessed through:
|
||||
$build_table->[$build_time][$build_name] = $buildrec;
|
||||
|
||||
The list of users who updated this build is stored as:
|
||||
$who_list->[$checkin_time]->{$author} = 1;
|
||||
|
||||
There are numerous duplicate data structures which hold partial
|
||||
information:
|
||||
|
||||
hashes which hold all indices:
|
||||
$build_name_index->{$br->{buildname}} = 1;
|
||||
$build_time_index->{$br->{buildtime}} = 1;
|
||||
other access into $build_table:
|
||||
$build_name_names->[$i] = $n;
|
||||
$build_time_times->[$i] = $n;
|
||||
|
||||
|
||||
loadquickparseinfo creates these references
|
||||
$build->{$buildname} = $buildstatus;
|
||||
$times->{$buildname} = $buildtime;
|
||||
|
||||
|
||||
|
||||
DATA FILES
|
||||
==========
|
||||
|
||||
These files are used to store data structures. They are a persistent
|
||||
store of data between executions of the same program and they pass the
|
||||
data between cooperating program. This data is often databases with
|
||||
rows separated by "\n" and columns by '|'.
|
||||
|
||||
|
||||
$tree/${logfile}
|
||||
$tree/${logfile}.brief.html
|
||||
$tree/ignorebuilds.pl
|
||||
$tree/mod.pl
|
||||
$tree/notes.txt
|
||||
$tree/treedata.pl
|
||||
$tree/who.dat
|
||||
$treename/build.dat
|
||||
|
||||
The logfile that the tinderbox client sent stored in gziped format.
|
||||
The filename is ${tree}/$builddate.$$.gz so its quite random and does
|
||||
not depend on the clients$build string and multiple logs are kept for
|
||||
each build, one for each mail message sent.
|
||||
|
||||
The brief.html file is a cache of the error log summary for this log
|
||||
file and is recreated when the logfile gets updated.
|
||||
|
||||
ignorebuilds.pl is a file which specifies builds that should not be
|
||||
performed. It is valid perl code which sets the hash reference
|
||||
$ignore_builds, each key is a tree name.
|
||||
|
||||
mod.pl stores the tree specific message of the day. This is not to be
|
||||
confused with mod perl the CGI library. Its contents looks like:
|
||||
$message_of_day = 'message';
|
||||
|
||||
notes.txt store the database of notes:
|
||||
$buildtime|$buildname||$author|$time_now|$note
|
||||
|
||||
|
||||
treedata.pl stores the cvs information pertaining to this tree and
|
||||
looks like this:
|
||||
$cvs_module='$modulename';
|
||||
$cvs_branch='$branchname';
|
||||
$cvs_root='$repository';
|
||||
|
||||
who.dat file has lines like:
|
||||
$checkin_time|$author
|
||||
This gets stored in the data structure, where checkin_time
|
||||
gets fudged up so that is is a time already in the
|
||||
build_table:
|
||||
$who_list->[$checkin_time]->{$author} = 1;
|
||||
|
||||
build.dat stores the build results table. It is a flat file
|
||||
representation of $build_table
|
||||
|
||||
build.dat is a database file each row is a build and has pipe
|
||||
separated columns:
|
||||
|
||||
1) the time stamp of the tinderbox server
|
||||
2) time stamp of the build machine
|
||||
3) the official build name (should include build machine name)
|
||||
( note: that 2 & 3 together uniquely identify the build
|
||||
and all relevant build data)
|
||||
4) the architecture dependent error parser to use on the log files
|
||||
5) status of the build (success|busted|building|testfailed)
|
||||
6) The log file for this build (if completed)
|
||||
7) the name of the binary (if any) that came from the build
|
||||
|
||||
|
||||
Other Files
|
||||
====================
|
||||
1afi003r.gif The "flames" animation used by showbuilds.cgi
|
||||
|
||||
Empty.html Document used for an empty frame by ???
|
||||
|
||||
addimage.cgi The form that lets you add a new image to the list of
|
||||
images that Tinderbox picks from randomly.
|
||||
|
||||
addnote.cgi Add a note to a build log.
|
||||
|
||||
admintree.cgi Lets you perform various admin tasks on a Tinderbox tree.
|
||||
This just prompts for a password and posts to doadmin.cgi.
|
||||
|
||||
clean.pl ???
|
||||
copydata.pl ???
|
||||
|
||||
doadmin.cgi Actually do the work to admin a tinderbox tree
|
||||
|
||||
ep_mac.pl Knows how to parse Mac build error logs. Used by ???
|
||||
ep_unix.pl Knows how to parse Unix build error logs. Used by ???
|
||||
ep_windows.pl Knows how to parse Windows build error logs. Used by ???
|
||||
|
||||
faq.html Wildly out of date.
|
||||
|
||||
fixupimages.pl ???
|
||||
globals.pl ???
|
||||
imagelog.pl ???
|
||||
index.html ???
|
||||
reledanim.gif ???
|
||||
|
||||
showimages.cgi Show all the images in the Tinderbox list. Password-protected.
|
||||
|
||||
star.gif The "star" image used to annotate builds by ???
|
||||
404
mozilla/webtools/tinderbox/addimage.cgi
Executable file
404
mozilla/webtools/tinderbox/addimage.cgi
Executable file
@@ -0,0 +1,404 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use Socket;
|
||||
|
||||
use lib "../bonsai";
|
||||
require 'header.pl';
|
||||
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
EmitHtmlTitleAndHeader("tinderbox: add images", "add images");
|
||||
|
||||
$| = 1;
|
||||
|
||||
require "globals.pl";
|
||||
require "imagelog.pl";
|
||||
|
||||
&split_cgi_args;
|
||||
|
||||
|
||||
sub Error {
|
||||
my ($msg) = @_;
|
||||
print "<BR><BR><BR>";
|
||||
print "<UL><FONT SIZE='+1'><B>Something went wrong:</B><P>";
|
||||
print "<UL>";
|
||||
print $msg;
|
||||
print "</UL>";
|
||||
print "<P>";
|
||||
print "Hit <B>\`Back'</B> and try again.";
|
||||
print "</UL>";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
if( $url = $form{"url"} ){
|
||||
$quote = $form{"quote"};
|
||||
|
||||
$quote =~ s/[\r\n]/ /g;
|
||||
$url =~ s/[\r\n]/ /g;
|
||||
|
||||
$width = "";
|
||||
$height = "";
|
||||
# I think we don't want to allow this --jwz
|
||||
# $width = $form{"width"};
|
||||
# $height = $form{"height"};
|
||||
|
||||
if ($width eq "" || $height eq "") {
|
||||
$size = &URLsize($url);
|
||||
if ($size =~ /WIDTH=([0-9]*)/) {
|
||||
$width = $1;
|
||||
}
|
||||
if ($size =~ /HEIGHT=([0-9]*)/) {
|
||||
$height = $1;
|
||||
}
|
||||
if ($width eq "" || $height eq "") {
|
||||
Error "Couldn't get image size for \"$url\".\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "
|
||||
|
||||
<P><center><img border=2 src='$url' width=$width height=$height><br>
|
||||
<i>$quote</i><br><br>
|
||||
";
|
||||
|
||||
if( $form{"submit"} ne "Yes" ){
|
||||
my $u2 = $url;
|
||||
my $q2 = $quote;
|
||||
$u2 =~ s@&@&@g; $u2 =~ s@<@<@g; $u2 =~ s@\"@"@g;
|
||||
$q2 =~ s@&@&@g; $q2 =~ s@<@<@g; $q2 =~ s@\"@"@g;
|
||||
|
||||
print "
|
||||
<form action='addimage.cgi' METHOD='get'>
|
||||
<input type=hidden name=url value=\"$u2\">
|
||||
<input type=hidden name=quote value=\"$q2\">
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TH ALIGN=RIGHT NOWRAP>Image URL:</TH>
|
||||
<TD><TT><B>$u2</B></TT></TD>
|
||||
</TR><TR>
|
||||
<TH ALIGN=RIGHT>Caption:</TH>
|
||||
<TD><TT><B>$q2</B></TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD></TD>
|
||||
<TD>
|
||||
<FONT SIZE=+2><B>
|
||||
Does that look right?
|
||||
<SPACER SIZE=10>
|
||||
<INPUT Type='submit' name='submit' value='Yes'>
|
||||
</B><BR>(If not, hit \`Back' and fix it.)
|
||||
</FONT>
|
||||
</TD>
|
||||
</TABLE>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
else {
|
||||
&add_imagelog( $url, $quote, $width, $height );
|
||||
print "<br><br>
|
||||
<font size=+2>Has been added</font><br><br>
|
||||
<a href=showbuilds.cgi>Return to Log</a>";
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
print "
|
||||
<h2>Add an image and a funny caption.</h2>
|
||||
|
||||
<ul>
|
||||
<p>This is about fun, and making your daily excursion to
|
||||
<A HREF=http://www.mozilla.org/tinderbox.html>Tinderbox</A> a
|
||||
novel experience. Engineers spend a lot of time here; it might as well
|
||||
have some entertainment value.
|
||||
|
||||
<p>Please play nice. We don't have the time or inclination to look at
|
||||
everything you people submit, but if we get nastygrams or legalgrams
|
||||
and have to take something down, we will curse your IP address, and you
|
||||
might even make it so the whole thing goes away forever. Please don't
|
||||
make us go there. You might also avoid links to big images or slow
|
||||
servers.
|
||||
|
||||
<p><ul><B>Thank you for playing nice.</B></UL>
|
||||
|
||||
<p>If you really find an image offensive, please
|
||||
<A HREF=mailto:terry\@netscape.com?Subject=offensive%20tinderbox%20image>tell us</A>
|
||||
nicely before someone causes a stink. Be sure to include the URL of
|
||||
the image. Remember, we don't screen these submissions and may not
|
||||
have even seen it.
|
||||
|
||||
<p><ul><B>P.S. Please, no more pictures of Bill Gates.</B></UL>
|
||||
</ul>
|
||||
|
||||
<p><form action='addimage.cgi' METHOD='get'>
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TH ALIGN=RIGHT NOWRAP>Image URL:</TH>
|
||||
<TD><INPUT NAME='url' SIZE=60></TD>
|
||||
</TR><TR>
|
||||
<TH ALIGN=RIGHT>Caption:</TH>
|
||||
<TD><INPUT NAME='quote' SIZE=60></TD>
|
||||
</TR><TR>
|
||||
<TD></TD>
|
||||
<TD><B>
|
||||
<INPUT Type='submit' name='submit' value='Test'>
|
||||
<SPACER SIZE=25>
|
||||
<INPUT Type='reset' name='reset' value='Reset'>
|
||||
</B></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</form>
|
||||
<br><br>
|
||||
";
|
||||
}
|
||||
|
||||
sub split_cgi_args {
|
||||
local($i,$var,$value, $s);
|
||||
|
||||
$s = $ENV{"QUERY_STRING"};
|
||||
|
||||
@args= split(/\&/, $s );
|
||||
|
||||
for $i (@args) {
|
||||
($var, $value) = split(/=/, $i);
|
||||
$value =~ tr/+/ /;
|
||||
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
|
||||
$form{$var} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#sub imgsize {
|
||||
# local($file)= @_;
|
||||
#
|
||||
# #first try to open the file
|
||||
# if( !open(STREAM, "<$file") ){
|
||||
# Error "Can't open IMG $file";
|
||||
## $size="";
|
||||
# } else {
|
||||
# if ($file =~ /.jpg/i || $file =~ /.jpeg/i) {
|
||||
# $size = &jpegsize(STREAM);
|
||||
# } elsif($file =~ /.gif/i) {
|
||||
# $size = &gifsize(STREAM);
|
||||
# } elsif($file =~ /.xbm/i) {
|
||||
# $size = &xbmsize(STREAM);
|
||||
# } else {
|
||||
# return "";
|
||||
# }
|
||||
# $_ = $size;
|
||||
# if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
# ($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
# }
|
||||
# if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
# ($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
# }
|
||||
# close(STREAM);
|
||||
# }
|
||||
# return $size;
|
||||
#}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine gets the size of the specified GIF
|
||||
###########################################################################
|
||||
|
||||
# bug: it thinks that
|
||||
# http://cvs1.mozilla.org/webtools/tinderbox/data/knotts.gif
|
||||
# is 640x400, but it's really 200x245.
|
||||
# giftrans says of that image:
|
||||
#
|
||||
# Header: "GIF87a"
|
||||
# Logical Screen Descriptor:
|
||||
# Logical Screen Width: 640 pixels
|
||||
# Logical Screen Height: 480 pixels
|
||||
# Image Descriptor:
|
||||
# Image Width: 200 pixels
|
||||
# Image Height: 245 pixels
|
||||
|
||||
|
||||
sub gifsize {
|
||||
local($GIF) = @_;
|
||||
read($GIF, $type, 6);
|
||||
if(!($type =~ /GIF8[7,9]a/) ||
|
||||
!(read($GIF, $s, 4) == 4) ){
|
||||
Error "Invalid or Corrupted GIF";
|
||||
$size="";
|
||||
} else {
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join ("", 'WIDTH=', $b<<8|$a, ' HEIGHT=', $d<<8|$c);
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
sub xbmsize {
|
||||
local($XBM) = @_;
|
||||
local($input)="";
|
||||
|
||||
$input .= <$XBM>;
|
||||
$input .= <$XBM>;
|
||||
$_ = $input;
|
||||
if( /#define\s*\S*\s*\d*\s*\n#define\s*\S*\s*\d*\s*\n/i ){
|
||||
($a,$b)=/#define\s*\S*\s*(\d*)\s*\n#define\s*\S*\s*(\d*)\s*\n/i;
|
||||
$size=join ("", 'WIDTH=', $a, ' HEIGHT=', $b );
|
||||
} else {
|
||||
Error "Doesn't look like an XBM file";
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
# jpegsize : gets the width and height (in pixels) of a jpeg file
|
||||
# Andrew Tong, werdna@ugcs.caltech.edu February 14, 1995
|
||||
# modified slightly by alex@ed.ac.uk
|
||||
sub jpegsize {
|
||||
local($JPEG) = @_;
|
||||
local($done)=0;
|
||||
$size="";
|
||||
|
||||
read($JPEG, $c1, 1); read($JPEG, $c2, 1);
|
||||
if( !((ord($c1) == 0xFF) && (ord($c2) == 0xD8))){
|
||||
my $s = sprintf "This is not a JPEG! (Codes %02X %02X)\n", ord($c1), ord($c2);
|
||||
Error $s;
|
||||
$done=1;
|
||||
}
|
||||
while (ord($ch) != 0xDA && !$done) {
|
||||
# Find next marker (JPEG markers begin with 0xFF)
|
||||
# This can hang the program!!
|
||||
while (ord($ch) != 0xFF) { read($JPEG, $ch, 1); }
|
||||
# JPEG markers can be padded with unlimited 0xFF's
|
||||
while (ord($ch) == 0xFF) { read($JPEG, $ch, 1); }
|
||||
# Now, $ch contains the value of the marker.
|
||||
$marker=ord($ch);
|
||||
|
||||
if (($marker >= 0xC0) && ($marker <= 0xCF) &&
|
||||
($marker != 0xC4) && ($marker != 0xCC)) { # it's a SOFn marker
|
||||
read ($JPEG, $junk, 3); read($JPEG, $s, 4);
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join("", 'HEIGHT=',$a<<8|$b,' WIDTH=',$c<<8|$d );
|
||||
$done=1;
|
||||
} else {
|
||||
# We **MUST** skip variables, since FF's within variable
|
||||
# names are NOT valid JPEG markers
|
||||
read ($JPEG, $s, 2);
|
||||
($c1, $c2) = unpack("C"x2,$s);
|
||||
$length = $c1<<8|$c2;
|
||||
if( ($length < 2) ){
|
||||
Error "Bad JPEG file: erroneous marker length";
|
||||
$done=1;
|
||||
} else {
|
||||
read($JPEG, $junk, $length-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine grabs a gif from another server and gets its size
|
||||
###########################################################################
|
||||
|
||||
|
||||
sub URLsize {
|
||||
my ($fullurl) = @_;
|
||||
|
||||
$_ = $fullurl;
|
||||
if ( ! m@^http://@ ) {
|
||||
Error "HTTP URLs only, please: \"$_\" is no good.";
|
||||
}
|
||||
|
||||
my($dummy, $dummy, $serverstring, $url) = split(/\//, $fullurl, 4);
|
||||
my($them,$port) = split(/:/, $serverstring);
|
||||
my $port = 80 unless $port;
|
||||
my $size="";
|
||||
|
||||
$_ = $them;
|
||||
if ( m@^[^.]*$@ ) {
|
||||
Error "Fully-qualified host names only, please: \"$_\" is no good.";
|
||||
}
|
||||
|
||||
$_=$url;
|
||||
my ($remote, $iaddr, $paddr, $proto, $line);
|
||||
$remote = $them;
|
||||
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
|
||||
die "No port" unless $port;
|
||||
$iaddr = inet_aton($remote) || die "no host: $remote";
|
||||
$paddr = sockaddr_in($port, $iaddr);
|
||||
|
||||
$proto = getprotobyname('tcp');
|
||||
socket(S, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
|
||||
connect(S, $paddr) || die "connect: $!";
|
||||
select(S); $| = 1; select(STDOUT);
|
||||
|
||||
print S "GET /$url HTTP/1.0\r\n";
|
||||
print S "Host: $them\r\n";
|
||||
print S "User-Agent: Tinderbox/0.0\r\n";
|
||||
print S "\r\n";
|
||||
|
||||
$_ = <S>;
|
||||
if (! m@^HTTP/[0-9.]+ 200@ ) {
|
||||
Error "$them responded:<BR> $_";
|
||||
}
|
||||
|
||||
my $ctype = "";
|
||||
while (<S>) {
|
||||
# print "read: $_<br>\n";
|
||||
if ( m@^Content-Type:[ \t]*([^ \t\r\n]+)@io ) {
|
||||
$ctype = $1;
|
||||
}
|
||||
last if (/^[\r\n]/);
|
||||
}
|
||||
|
||||
$_ = $ctype;
|
||||
if ( $_ eq "" ) {
|
||||
Error "Server returned no content-type for \"$fullurl\"?";
|
||||
} elsif ( m@image/jpeg@i || m@image/pjpeg@i ) {
|
||||
$size = &jpegsize(S);
|
||||
} elsif ( m@image/gif@i ) {
|
||||
$size = &gifsize(S);
|
||||
} elsif ( m@image/xbm@i || m@image/x-xbm@i || m@image/x-xbitmap@i ) {
|
||||
$size = &xbmsize(S);
|
||||
} else {
|
||||
Error "Not a GIF, JPEG, or XBM: that was of type \"$ctype\".";
|
||||
}
|
||||
|
||||
$_ = $size;
|
||||
if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
|
||||
if ( $newwidth eq "" || $newheight eq "" ) {
|
||||
return "";
|
||||
} else {
|
||||
if ( $newwidth <= 5 || $newheight <= 5 ) {
|
||||
Error "${newwidth}x${newheight} seems small, don't you think?";
|
||||
} elsif ( $newwidth >= 400 || $newheight >= 400 ) {
|
||||
Error "${newwidth}x${newheight} is too big; please" .
|
||||
" keep it under 400x400."
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
}
|
||||
|
||||
sub dokill {
|
||||
kill 9,$child if $child;
|
||||
}
|
||||
206
mozilla/webtools/tinderbox/addnote.cgi
Executable file
206
mozilla/webtools/tinderbox/addnote.cgi
Executable file
@@ -0,0 +1,206 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use lib "../bonsai";
|
||||
use Fcntl;
|
||||
|
||||
require "globals.pl";
|
||||
require 'lloydcgi.pl';
|
||||
|
||||
if (defined($args = $form{log})) {
|
||||
|
||||
($tree, $logfile) = split /\//, $args;
|
||||
|
||||
my $br = find_build_record($tree, $logfile);
|
||||
$errorparser = $br->{errorparser};
|
||||
$buildname = $br->{buildname};
|
||||
$buildtime = $br->{buildtime};
|
||||
} else {
|
||||
$tree = $form{'tree'};
|
||||
$logfile = $form{'logfile'};
|
||||
$errorparser = $form{'errorparser'};
|
||||
$buildname = $form{'buildname'};
|
||||
$buildtime = $form{'buildtime'};
|
||||
}
|
||||
|
||||
$enc_buildname = &url_encode($buildname);
|
||||
|
||||
$note = $form{'note'};
|
||||
$who = $form{'who'};
|
||||
|
||||
$now = time;
|
||||
$now_str = &print_time($now);
|
||||
|
||||
$|=1;
|
||||
|
||||
if( -r "$tree/ignorebuilds.pl" ){
|
||||
require "$tree/ignorebuilds.pl";
|
||||
}
|
||||
|
||||
print "Content-Type:text/html\n";
|
||||
if ($ENV{"REQUEST_METHOD"} eq 'POST' && defined($form{'note'})) {
|
||||
# Expire the cookie 5 months from now
|
||||
print "Set-Cookie: email=$form{who}; expires="
|
||||
. toGMTString(time + 86400 * 152) . "; path=/\n";
|
||||
}
|
||||
print "\n<HTML>\n";
|
||||
|
||||
if( $url = $form{"note"} ){
|
||||
|
||||
$note =~ s/\&/&/gi;
|
||||
$note =~ s/\</</gi;
|
||||
$note =~ s/\>/>/gi;
|
||||
$enc_note = url_encode( $note );
|
||||
|
||||
open( NOTES,">>$tree/notes.txt");
|
||||
flock(NOTES, LOCK_EX);
|
||||
print NOTES "$buildtime|$buildname|$who|$now|$enc_note\n";
|
||||
|
||||
&LoadBuildTable;
|
||||
|
||||
foreach $element (keys %form) {
|
||||
|
||||
if(exists ${$build_name_index}{$element}) {
|
||||
print NOTES "${$build_name_index}{$element}|$element|$who|$now|$enc_note\n";
|
||||
} #EndIf
|
||||
} #Endforeach
|
||||
close(NOTES);
|
||||
|
||||
print "<H1>The following comment has been added to the log</h1>\n";
|
||||
|
||||
#print "$buildname \n $buildtime \n $errorparser \n $logfile \n $tree \n $enc_buildname \n";
|
||||
print "<pre>\n[<b>$who - $now_str</b>]\n$note\n</pre>";
|
||||
|
||||
print"
|
||||
<p><a href=\"showlog.cgi?tree=$tree\&buildname=$enc_buildname\&buildtime=$buildtime\&logfile=$logfile\&errorparser=$errorparser\">
|
||||
Go back to the Error Log</a>
|
||||
<a href=\"showbuilds.cgi?tree=$tree\">
|
||||
<br>Go back to the build Page</a>";
|
||||
|
||||
# Build tinderbox static pages
|
||||
$ENV{QUERY_STRING}="tree=$tree&static=1";
|
||||
$ENV{REQUEST_METHOD}="GET";
|
||||
system './showbuilds.cgi >/dev/null';
|
||||
|
||||
} else {
|
||||
|
||||
&GetBuildNameIndex;
|
||||
|
||||
@names = sort (keys %$build_name_index);
|
||||
|
||||
if ($buildname eq '' || $buildtime == 0) {
|
||||
print "<h1>Invalid parameters</h1>\n";
|
||||
die "\n";
|
||||
}
|
||||
|
||||
#print "$buildname \n $buildtime \n $errorparser \n $logfile \n $tree \n $enc_buildname \n";
|
||||
|
||||
$emailvalue = '';
|
||||
$emailvalue = " value='$cookie_jar{email}'" if defined($cookie_jar{email});
|
||||
|
||||
print qq(
|
||||
<head><title>Add a Comment to $buildname log</title></head>
|
||||
<body BGCOLOR="#FFFFFF" TEXT="#000000"LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
|
||||
|
||||
<table><tr><td>
|
||||
<b><font size="+2">Add a Log Comment</font></b>
|
||||
</td></tr><tr><td>
|
||||
<b><code>$buildname</code></b>
|
||||
</td></tr></table>
|
||||
|
||||
<form action='addnote.cgi' METHOD='post'>
|
||||
|
||||
<INPUT Type='hidden' name='buildname' value='${buildname}'>
|
||||
<INPUT Type='hidden' name='buildtime' value='${buildtime}'>
|
||||
<INPUT Type='hidden' name='errorparser' value='$errorparser'>
|
||||
<INPUT Type='hidden' name='logfile' value='$logfile'>
|
||||
<INPUT Type='hidden' name='tree' value='$tree'>
|
||||
|
||||
<table border=0 cellpadding=4 cellspacing=1>
|
||||
<tr valign=top>
|
||||
<td align=right>
|
||||
<NOWRAP>Email address:</NOWRAP>
|
||||
</td><td>
|
||||
<INPUT Type='input' name='who' size=32$emailvalue><BR>
|
||||
</td>
|
||||
</tr><tr valign=top>
|
||||
<td align=right>
|
||||
Comment:
|
||||
</td><td>
|
||||
<TEXTAREA NAME=note ROWS=10 COLS=30 WRAP=HARD></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><b><font size="+2">Addition Builds</font></b><br>
|
||||
(Comment will be added to the most recent cycle.)<br>
|
||||
);
|
||||
|
||||
for $other_build (@names){
|
||||
if( $other_build ne "" ){
|
||||
|
||||
if (not exists ${$ignore_builds}{$other_build}) {
|
||||
if( $other_build ne $buildname ){
|
||||
print "<INPUT TYPE=checkbox NAME=\"$other_build\">";
|
||||
print "$other_build<BR>\n";
|
||||
}
|
||||
} #EndIf
|
||||
}
|
||||
} #Endfor
|
||||
|
||||
print "<INPUT Type='submit' name='submit' value='Add Comment'><BR>
|
||||
</form>\n</body>\n</html>";
|
||||
}
|
||||
|
||||
sub GetBuildNameIndex {
|
||||
local($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname);
|
||||
|
||||
open(BUILDLOG, "$tree/build.dat") or die "Couldn't open build.dat: $!\n";
|
||||
|
||||
while(<BUILDLOG>) {
|
||||
chomp;
|
||||
($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname) =
|
||||
split( /\|/ );
|
||||
|
||||
$build_name_index->{$buildname} = 0;
|
||||
|
||||
} #EndWhile
|
||||
close(BUILDLOG);
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub LoadBuildTable {
|
||||
local($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname);
|
||||
|
||||
open(BUILDLOG, "$tree/build.dat") or die "Couldn't open build.dat: $!\n";
|
||||
|
||||
while(<BUILDLOG>) {
|
||||
chomp;
|
||||
($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname) =
|
||||
split( /\|/ );
|
||||
|
||||
if ($buildtime > $build_name_index->{$buildname} ) {
|
||||
$build_name_index->{$buildname} = $buildtime;
|
||||
}
|
||||
|
||||
} #EndWhile
|
||||
close(BUILDLOG);
|
||||
|
||||
}
|
||||
|
||||
131
mozilla/webtools/tinderbox/admintree.cgi
Executable file
131
mozilla/webtools/tinderbox/admintree.cgi
Executable file
@@ -0,0 +1,131 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use lib "../bonsai";
|
||||
|
||||
require 'lloydcgi.pl';
|
||||
require 'globals.pl';
|
||||
require 'header.pl';
|
||||
|
||||
$|=1;
|
||||
|
||||
print "Content-type: text/html\n\n<HTML>\n";
|
||||
|
||||
EmitHtmlHeader("administer tinderbox", "tree: $tree");
|
||||
|
||||
$form{noignore} = 1; # Force us to load all build info, not
|
||||
# paying any attention to ignore_builds stuff.
|
||||
$maxdate = time();
|
||||
$mindate = $maxdate - 24*60*60;
|
||||
&load_data;
|
||||
|
||||
if (defined($tree)) {
|
||||
if( -r "$tree/mod.pl" ){
|
||||
require "$tree/mod.pl";
|
||||
}
|
||||
else {
|
||||
$message_of_day = "";
|
||||
}
|
||||
|
||||
print "
|
||||
<FORM method=post action=doadmin.cgi>
|
||||
<B>Password:</B> <INPUT NAME=password TYPE=password>
|
||||
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
|
||||
<INPUT TYPE=HIDDEN NAME=command VALUE=set_message>
|
||||
<br><b>Message of the Day
|
||||
<br><TEXTAREA NAME=message ROWS=10 COLS=70 WRAP=SOFT>$message_of_day
|
||||
</TEXTAREA>
|
||||
<br><INPUT TYPE=SUBMIT VALUE='Set Message of the Day'>
|
||||
</FORM>
|
||||
<hr>
|
||||
";
|
||||
|
||||
|
||||
print "
|
||||
<FORM method=post action=doadmin.cgi>
|
||||
<B>Password:</B> <INPUT NAME=password TYPE=password>
|
||||
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
|
||||
<INPUT TYPE=HIDDEN NAME=command VALUE=trim_logs>
|
||||
<br><b>Trim Logs to <INPUT NAME=days size=5 VALUE='7'> days.</b> (Tinderbox
|
||||
shows 2 days history by default. You can see more by clicking show all).
|
||||
<br><INPUT TYPE=SUBMIT VALUE='Trim Logs'>
|
||||
</FORM>
|
||||
<FORM method=post action=doadmin.cgi>
|
||||
<hr>
|
||||
" ;
|
||||
}
|
||||
|
||||
print "
|
||||
<FORM method=post action=doadmin.cgi>
|
||||
<B>Password:</B> <INPUT NAME=password TYPE=password> <BR>
|
||||
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
|
||||
<INPUT TYPE=HIDDEN NAME=command VALUE=create_tree>
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TD><B>tinderbox tree name:</B></TD>
|
||||
<TD><INPUT NAME=treename VALUE=''></TD>
|
||||
</TR><TR>
|
||||
<TD><B>cvs repository:</B></TD>
|
||||
<TD><INPUT NAME=repository VALUE=''></TD>
|
||||
</TR><TR>
|
||||
<TD><B>cvs module name:</B></TD>
|
||||
<TD><INPUT NAME=modulename VALUE=''></TD>
|
||||
</TR><TR>
|
||||
<TD><B>cvs branch:</B></TD>
|
||||
<TD><INPUT NAME=branchname VALUE='HEAD'></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<INPUT TYPE=SUBMIT VALUE='Create a new Tinderbox page'>
|
||||
</FORM>
|
||||
<FORM method=post action=doadmin.cgi>
|
||||
<hr>
|
||||
";
|
||||
|
||||
if (defined($tree)) {
|
||||
print "
|
||||
<B><font size=+1>If builds are behaving badly you can turn them off.</font></b><br> Uncheck
|
||||
the build that is misbehaving and click the button. You can still see all the
|
||||
builds even if some are disabled by adding the parameter <b><tt>&noignore=1</tt></b> to
|
||||
the tinderbox URL.<br>
|
||||
<B>Password:</B> <INPUT NAME=password TYPE=password> <BR>
|
||||
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
|
||||
<INPUT TYPE=HIDDEN NAME=command VALUE=disable_builds>
|
||||
";
|
||||
|
||||
@names = sort (@$build_name_names) ;
|
||||
|
||||
for $i (@names){
|
||||
if( $i ne "" ){
|
||||
$checked = ($ignore_builds->{$i} != 0 ? "": "CHECKED" );
|
||||
print "<INPUT TYPE=checkbox NAME='build_$i' $checked >";
|
||||
print "$i<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "
|
||||
<INPUT TYPE=SUBMIT VALUE='Show only checked builds'>
|
||||
</FORM>
|
||||
<hr>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
97
mozilla/webtools/tinderbox/buildwho.pl
Executable file
97
mozilla/webtools/tinderbox/buildwho.pl
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use lib "../bonsai";
|
||||
|
||||
require 'globals.pl';
|
||||
|
||||
$F_DEBUG=1;
|
||||
|
||||
|
||||
$days = 2;
|
||||
|
||||
if ($ARGV[0] eq "-days") {
|
||||
shift @ARGV;
|
||||
$days = shift @ARGV;
|
||||
}
|
||||
|
||||
$tree = $ARGV[0];
|
||||
|
||||
open(SEMFILE, ">>$tree/buildwho.sem") || die "Couldn't open semaphore file!";
|
||||
if (!flock(SEMFILE, 2 + 4)) { # 2 means "lock"; 4 means "fail immediately if
|
||||
# lock already taken".
|
||||
print "buildwho.pl: Another process is currently building the database.\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
require "$tree/treedata.pl";
|
||||
|
||||
if( $cvs_root eq '' ){
|
||||
$CVS_ROOT = '/m/src';
|
||||
}
|
||||
else {
|
||||
$CVS_ROOT = $cvs_root;
|
||||
}
|
||||
|
||||
$CVS_REPOS_SUFIX = $CVS_ROOT;
|
||||
$CVS_REPOS_SUFIX =~ s/\//_/g;
|
||||
|
||||
$CHECKIN_DATA_FILE = "/d/webdocs/projects/bonsai/data/checkinlog${CVS_REPOS_SUFIX}";
|
||||
$CHECKIN_INDEX_FILE = "/d/webdocs/projects/bonsai/data/index${CVS_REPOS_SUFIX}";
|
||||
|
||||
require 'cvsquery.pl';
|
||||
|
||||
print "cvsroot='$CVS_ROOT'\n";
|
||||
|
||||
&build_who;
|
||||
|
||||
flock(SEMFILE, 8); # '8' is magic 'unlock' const.
|
||||
close SEMFILE;
|
||||
|
||||
|
||||
sub build_who {
|
||||
open(BUILDLOG, "<$tree/build.dat" );
|
||||
$line = <BUILDLOG>;
|
||||
close(BUILDLOG);
|
||||
|
||||
#($j,$query_date_min) = split(/\|/, $line);
|
||||
$query_date_min = time - (60 * 60 * 24 * $days);
|
||||
|
||||
if( $F_DEBUG ){
|
||||
print "Minimum date: $query_date_min\n";
|
||||
}
|
||||
|
||||
$query_module=$cvs_module;
|
||||
$query_branch=$cvs_branch;
|
||||
|
||||
$result = &query_checkins;
|
||||
|
||||
|
||||
$last_who='';
|
||||
$last_date=0;
|
||||
open(WHOLOG, ">$tree/who.dat" );
|
||||
for $ci (@$result) {
|
||||
if( $ci->[$CI_DATE] != $last_date || $ci->[$CI_WHO] != $last_who ){
|
||||
print WHOLOG "$ci->[$CI_DATE]|$ci->[$CI_WHO]\n";
|
||||
}
|
||||
$last_who=$ci->[$CI_WHO];
|
||||
$last_date=$ci->[$CI_DATE];
|
||||
}
|
||||
close( WHOLOG );
|
||||
}
|
||||
124
mozilla/webtools/tinderbox/bustagestats.cgi
Executable file
124
mozilla/webtools/tinderbox/bustagestats.cgi
Executable file
@@ -0,0 +1,124 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use lib "../bonsai";
|
||||
|
||||
require 'lloydcgi.pl';
|
||||
require 'globals.pl';
|
||||
require 'header.pl';
|
||||
|
||||
use Date::Parse;
|
||||
use Date::Format;
|
||||
|
||||
my $TIMEFORMAT = "%D %T";
|
||||
|
||||
$|=1;
|
||||
|
||||
print "Content-type: text/html\n\n<HTML>\n";
|
||||
|
||||
# &load_data;
|
||||
|
||||
EmitHtmlHeader("Statistics");
|
||||
|
||||
my $tree = $form{'tree'};
|
||||
my $start = $form{'start'};
|
||||
my $end = $form{'end'};
|
||||
|
||||
sub str2timeAndCheck {
|
||||
my ($str) = (@_);
|
||||
my $result = str2time($str);
|
||||
if (defined $result && $result > 7000000) {
|
||||
return $result;
|
||||
}
|
||||
print "<p><font color=red>Can't parse as a date: $str</font><p>\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (defined $tree && defined $start && defined $end) {
|
||||
my $first = str2timeAndCheck($start);
|
||||
my $last = str2timeAndCheck($end);
|
||||
if ($first > 0 && $last > 0) {
|
||||
if (open(IN, "<$tree/build.dat")) {
|
||||
print "<hr><center><h1>Bustage stats for $tree</H1><H3>from " .
|
||||
time2str($TIMEFORMAT, $first) . " to " .
|
||||
time2str($TIMEFORMAT, $last) . "</H3></center>\n";
|
||||
my %stats;
|
||||
while (<IN>) {
|
||||
chomp;
|
||||
my ($mailtime, $buildtime, $buildname, $errorparser,
|
||||
$buildstatus, $logfile, $binaryname) =
|
||||
split( /\|/ );
|
||||
if ($buildtime >= $first && $buildtime <= $last) {
|
||||
if (!defined $stats{$buildname}) {
|
||||
$stats{$buildname} = 0;
|
||||
}
|
||||
if ($buildstatus eq "busted") {
|
||||
$stats{$buildname}++;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "<table>\n";
|
||||
print "<tr><th>Build name</th><th>Number of bustages</th></tr>\n";
|
||||
foreach my $key (sort (keys %stats)) {
|
||||
print "<tr><td>$key</td><td>$stats{$key}</td></tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
} else {
|
||||
print "<p><font color=red>There does not appear to be a tree " .
|
||||
"named '$tree'.</font><p>";
|
||||
}
|
||||
|
||||
}
|
||||
print "<hr>\n";
|
||||
}
|
||||
|
||||
if (!defined $tree) {
|
||||
$tree = "";
|
||||
}
|
||||
|
||||
if (!defined $start) {
|
||||
$start = time2str($TIMEFORMAT, time() - 7*24*60*60); # One week ago.
|
||||
}
|
||||
|
||||
if (!defined $end) {
|
||||
$end = time2str($TIMEFORMAT, time()); # #now
|
||||
}
|
||||
|
||||
|
||||
print qq|
|
||||
<form>
|
||||
<table>
|
||||
<tr>
|
||||
<th align=right>Tree:</th>
|
||||
<td><input name=tree size=30 value="$tree"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=right>Start time:</th>
|
||||
<td><input name=start size=30 value="$start"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=right>End time:</th>
|
||||
<td><input name=end size=30 value="$end"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<INPUT TYPE=\"submit\" VALUE=\"Generate stats \">
|
||||
|
||||
</form>
|
||||
|;
|
||||
BIN
mozilla/webtools/tinderbox/channelflames.gif
Normal file
BIN
mozilla/webtools/tinderbox/channelflames.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
mozilla/webtools/tinderbox/channelok.gif
Normal file
BIN
mozilla/webtools/tinderbox/channelok.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 295 B |
42
mozilla/webtools/tinderbox/clean.pl
Executable file
42
mozilla/webtools/tinderbox/clean.pl
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
# Figure out which directory tinderbox is in by looking at argv[0]
|
||||
|
||||
$tinderboxdir = $0;
|
||||
$tinderboxdir =~ s:/[^/]*$::; # Remove last word, and slash before it.
|
||||
if ($tinderboxdir eq "") {
|
||||
$tinderboxdir = ".";
|
||||
}
|
||||
|
||||
#print "tinderbox = $tinderboxdir\n";
|
||||
|
||||
chdir $tinderboxdir || die "Couldn't chdir to $tinderboxdir";
|
||||
|
||||
#print "cd ok\n";
|
||||
|
||||
open FL, "find . -name \"*.gz\" -mtime +7 -print |";
|
||||
|
||||
#print "find ok\n";
|
||||
|
||||
while( <FL> ){
|
||||
chop();
|
||||
#print "unlink $_\n";
|
||||
unlink $_;
|
||||
}
|
||||
BIN
mozilla/webtools/tinderbox/cont.gif
Normal file
BIN
mozilla/webtools/tinderbox/cont.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 B |
91
mozilla/webtools/tinderbox/copydata.pl
Executable file
91
mozilla/webtools/tinderbox/copydata.pl
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/tools/ns/bin/perl5
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
#
|
||||
# to run this script execute 'nohup copydata.pl &' from the tinderbox directory
|
||||
#
|
||||
|
||||
$start_dir = `pwd`;
|
||||
chop($start_dir);
|
||||
$scp_cmd = "scp -o 'User snapshot' -o'Port 22' -o 'UserKnownHostsFile /u/shaver/snapshot/known_hosts' -o 'IdentityFile /u/shaver/snapshot/identity'";
|
||||
|
||||
|
||||
$last_time = 0;
|
||||
|
||||
$min_cycle_time = 3 * 60; # 3 minutes
|
||||
|
||||
print "starting dir is :$start_dir\n";
|
||||
|
||||
while( 1 ){
|
||||
chdir("$start_dir");
|
||||
if( time - $last_time < $min_cycle_time ){
|
||||
$sleep_time = $min_cycle_time - (time - $last_time);
|
||||
print "\n\nSleeping $sleep_time seconds ...\n";
|
||||
sleep( $sleep_time );
|
||||
}
|
||||
|
||||
©_data("Mozilla");
|
||||
©_data("raptor");
|
||||
|
||||
chdir( "$start_dir");
|
||||
print "$scp_cmd * cvs1.mozilla.org:/e/webtools/tinderbox\n";
|
||||
system "$scp_cmd * cvs1.mozilla.org:/e/webtools/tinderbox";
|
||||
|
||||
chdir( "$start_dir/../bonsai");
|
||||
print "$scp_cmd * cvs1.mozilla.org:/e/webtools/bonsai\n";
|
||||
system "$scp_cmd * cvs1.mozilla.org:/e/webtools/bonsai";
|
||||
|
||||
|
||||
$last_time = time;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
sub copy_data {
|
||||
local($data_dir) = @_;
|
||||
local($zips,$qry);
|
||||
|
||||
chdir $data_dir || die "couldn't chdir to $data_dir";
|
||||
|
||||
system "echo hello >lastup.new";
|
||||
|
||||
if( -r 'lastup' ) {
|
||||
$qry = '-newer lastup.old';
|
||||
rename 'lastup', 'lastup.old'
|
||||
}
|
||||
rename 'lastup.new', 'lastup';
|
||||
|
||||
|
||||
open( FINDER, "find . $qry -name \"*.gz\" -print|" );
|
||||
while(<FINDER>){
|
||||
print;
|
||||
chop;
|
||||
$zips .= "$_ ";
|
||||
}
|
||||
close( FINDER );
|
||||
|
||||
unlink 'lastup.old';
|
||||
|
||||
print "$scp_cmd *.txt $zips *.dat cvs1.mozilla.org:/e/webtools/tinderbox/$data_dir\n";
|
||||
system "$scp_cmd *.txt $zips *.dat cvs1.mozilla.org:/e/webtools/tinderbox/$data_dir";
|
||||
|
||||
|
||||
chdir $start_dir || die "couldn't chdir to $start_dir";
|
||||
}
|
||||
217
mozilla/webtools/tinderbox/doadmin.cgi
Executable file
217
mozilla/webtools/tinderbox/doadmin.cgi
Executable file
@@ -0,0 +1,217 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
|
||||
use lib "../bonsai";
|
||||
require 'lloydcgi.pl';
|
||||
require 'globals.pl';
|
||||
|
||||
umask O666;
|
||||
|
||||
|
||||
$|=1;
|
||||
|
||||
check_password();
|
||||
|
||||
print "Content-type: text/html\n\n<HTML>\n";
|
||||
|
||||
$command = $form{'command'};
|
||||
$tree= $form{'tree'};
|
||||
|
||||
if( $command eq 'create_tree' ){
|
||||
&create_tree;
|
||||
}
|
||||
elsif( $command eq 'remove_build' ){
|
||||
&remove_build;
|
||||
}
|
||||
elsif( $command eq 'trim_logs' ){
|
||||
&trim_logs;
|
||||
}
|
||||
elsif( $command eq 'set_message' ){
|
||||
&set_message;
|
||||
}
|
||||
elsif( $command eq 'disable_builds' ){
|
||||
&disable_builds;
|
||||
} else {
|
||||
print "Unknown command: \"$command\".";
|
||||
}
|
||||
|
||||
sub trim_logs {
|
||||
$days = $form{'days'};
|
||||
$tree = $form{'tree'};
|
||||
|
||||
print "<h2>Trimming Log files for $tree...</h2>\n<p>";
|
||||
|
||||
$min_date = time - (60*60*24 * $days);
|
||||
|
||||
#
|
||||
# Nuke the old log files
|
||||
#
|
||||
$i = 0;
|
||||
opendir( D, 'DogbertTip' );
|
||||
while( $fn = readdir( D ) ){
|
||||
if( $fn =~ /\.gz$/ ){
|
||||
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
|
||||
$ctime,$blksize,$blocks) = stat("$tree/$fn");
|
||||
if( $mtime && ($mtime < $min_date) ){
|
||||
print "$fn\n";
|
||||
$tblocks += $blocks;
|
||||
unlink( "$tree/$fn" );
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( D );
|
||||
$k = $tblocks*512/1024;
|
||||
print "<br><b>$i Logfiles ( $k K bytes ) removed</b><br>\n";
|
||||
|
||||
#
|
||||
# Trim build.dat
|
||||
#
|
||||
$builds_removed = 0;
|
||||
open(BD, "<$tree/build.dat");
|
||||
open(NBD, ">$tree/build.dat.new");
|
||||
while( <BD> ){
|
||||
($mailtime,$buildtime,$buildname) = split( /\|/ );
|
||||
if( $buildtime >= $min_date ){
|
||||
print NBD $_;
|
||||
}
|
||||
else {
|
||||
$builds_removed++;
|
||||
}
|
||||
}
|
||||
close( BD );
|
||||
close( NBD );
|
||||
|
||||
rename( "$tree/build.dat", "$tree/build.dat.old" );
|
||||
rename( "$tree/build.dat.new", "$tree/build.dat" );
|
||||
|
||||
print "<h2>$builds_removed Builds removed from build.dat</h2>\n";
|
||||
}
|
||||
|
||||
sub create_tree {
|
||||
$treename = $form{'treename'};
|
||||
my $repository = $form{'repository'};
|
||||
$modulename = $form{'modulename'};
|
||||
$branchname = $form{'branchname'};
|
||||
|
||||
if( -r $treename ){
|
||||
chmod 0777, $treename;
|
||||
}
|
||||
else {
|
||||
mkdir( $treename, 0777 ) || die "<h1> Cannot mkdir $treename</h1>";
|
||||
}
|
||||
open( F, ">$treename/treedata.pl" );
|
||||
print F "\$cvs_module='$modulename';\n";
|
||||
print F "\$cvs_branch='$branchname';\n";
|
||||
if ($repository ne "") {
|
||||
print F "\$cvs_root='$repository';\n";
|
||||
}
|
||||
close( F );
|
||||
|
||||
open( F, ">$treename/build.dat" );
|
||||
close( F );
|
||||
|
||||
open( F, ">$treename/who.dat" );
|
||||
close( F );
|
||||
|
||||
open( F, ">$treename/notes.txt" );
|
||||
close( F );
|
||||
|
||||
chmod 0777, "$treename/build.dat", "$treename/who.dat", "$treename/notes.txt",
|
||||
"$treename/treedata.pl";
|
||||
|
||||
print "<h2><a href=showbuilds.cgi?tree=$treename>Tree created or modified</a></h2>\n";
|
||||
}
|
||||
|
||||
sub remove_build {
|
||||
$build_name = $form{'build'};
|
||||
|
||||
#
|
||||
# Trim build.dat
|
||||
#
|
||||
$builds_removed = 0;
|
||||
open(BD, "<$tree/build.dat");
|
||||
open(NBD, ">$tree/build.dat.new");
|
||||
while( <BD> ){
|
||||
($mailtime,$buildtime,$bname) = split( /\|/ );
|
||||
if( $bname ne $build_name ){
|
||||
print NBD $_;
|
||||
}
|
||||
else {
|
||||
$builds_removed++;
|
||||
}
|
||||
}
|
||||
close( BD );
|
||||
close( NBD );
|
||||
chmod( 0777, "$tree/build.dat.new");
|
||||
|
||||
rename( "$tree/build.dat", "$tree/build.dat.old" );
|
||||
rename( "$tree/build.dat.new", "$tree/build.dat" );
|
||||
|
||||
print "<h2><a href=showbuilds.cgi?tree=$tree>
|
||||
$builds_removed Builds removed from build.dat</a></h2>\n";
|
||||
}
|
||||
|
||||
sub disable_builds {
|
||||
my $i,%buildnames;
|
||||
$build_name = $form{'build'};
|
||||
|
||||
#
|
||||
# Trim build.dat
|
||||
#
|
||||
open(BD, "<$tree/build.dat");
|
||||
while( <BD> ){
|
||||
($mailtime,$buildtime,$bname) = split( /\|/ );
|
||||
$buildnames{$bname} = 0;
|
||||
}
|
||||
close( BD );
|
||||
|
||||
for $i (keys %form) {
|
||||
if ($i =~ /^build_/ ){
|
||||
$i =~ s/^build_//;
|
||||
$buildnames{$i} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
open(IGNORE, ">$tree/ignorebuilds.pl");
|
||||
print IGNORE '$ignore_builds = {' . "\n";
|
||||
for $i ( sort keys %buildnames ){
|
||||
if( $buildnames{$i} == 0 ){
|
||||
print IGNORE "\t\t'$i' => 1,\n";
|
||||
}
|
||||
}
|
||||
print IGNORE "\t};\n";
|
||||
|
||||
chmod( 0777, "$tree/ignorebuilds.pl");
|
||||
print "<h2><a href=showbuilds.cgi?tree=$treename>Build state Changed</a></h2>\n";
|
||||
}
|
||||
|
||||
|
||||
sub set_message {
|
||||
$m = $form{'message'};
|
||||
$m =~ s/\'/\\'/g;
|
||||
open(MOD, ">$tree/mod.pl");
|
||||
print MOD "\$message_of_day = \'$m\'\;\n1;";
|
||||
close(MOD);
|
||||
chmod( 0777, "$tree/mod.pl");
|
||||
print "<h2><a href=showbuilds.cgi?tree=$tree>
|
||||
Message Changed</a></h2>\n";
|
||||
}
|
||||
|
||||
45
mozilla/webtools/tinderbox/ep_mac.pl
Executable file
45
mozilla/webtools/tinderbox/ep_mac.pl
Executable file
@@ -0,0 +1,45 @@
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
1;
|
||||
#
|
||||
# Scan a line and see if it has an error
|
||||
#
|
||||
sub has_error {
|
||||
$line =~ /fatal error/ # link error
|
||||
|| $line =~ /Error / # C error
|
||||
|| $line =~ /\[checkout aborted\]/ #cvs error
|
||||
|| $line =~ /Couldn\'t find project file / # CW project error
|
||||
;
|
||||
}
|
||||
|
||||
sub has_warning {
|
||||
$line =~ /^[A-Za-z0-9_]+\.[A-Za-z0-9]+\ line [0-9]+/ ;
|
||||
}
|
||||
|
||||
sub has_errorline {
|
||||
local( $line ) = @_;
|
||||
if( $line =~ /^(([A-Za-z0-9_]+\.[A-Za-z0-9]+) line ([0-9]+))/ ){
|
||||
$error_file = $1;
|
||||
$error_file_ref = $2;
|
||||
$error_line = $3;
|
||||
$error_guess = 1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
59
mozilla/webtools/tinderbox/ep_unix.pl
Executable file
59
mozilla/webtools/tinderbox/ep_unix.pl
Executable file
@@ -0,0 +1,59 @@
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
1;
|
||||
#
|
||||
# Scan a line and see if it has an error
|
||||
#
|
||||
sub has_error {
|
||||
$line =~ /fatal error/ # link error
|
||||
|| $line =~ /^C / # cvs merge conflict
|
||||
|| $line =~ / Error: / # C error
|
||||
|| $line =~ / error\([0-9]*\)\:/ # C error
|
||||
|| ($line =~ /gmake/ && $line =~ / Error /)
|
||||
|| $line =~ /\[checkout aborted\]/ #cvs error
|
||||
|| $line =~ /\: cannot find module/ #cvs error
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
sub has_warning {
|
||||
$line =~ /^[A-Za-z0-9_]+\.[A-Za-z0-9]+\:[0-9]+\:/
|
||||
|| $line =~ /^\"[A-Za-z0-9_]+\.[A-Za-z0-9]+\"\, line [0-9]+\:/
|
||||
;
|
||||
}
|
||||
|
||||
sub has_errorline {
|
||||
local( $line ) = @_;
|
||||
if( $line =~ /^(([A-Za-z0-9_]+\.[A-Za-z0-9]+)\:([0-9]+)\:)/ ){
|
||||
$error_file = $1;
|
||||
$error_file_ref = $2;
|
||||
$error_line = $3;
|
||||
$error_guess = 1;
|
||||
return 1;
|
||||
}
|
||||
if ( $line =~ /^(\"([A-Za-z0-9_]+\.[A-Za-z0-9]+)\"\, line ([0-9]+)\:)/ ){
|
||||
$error_file = $1;
|
||||
$error_file_ref = $2;
|
||||
$error_line = $3;
|
||||
$error_guess = 1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
73
mozilla/webtools/tinderbox/ep_windows.pl
Executable file
73
mozilla/webtools/tinderbox/ep_windows.pl
Executable file
@@ -0,0 +1,73 @@
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
1;
|
||||
#
|
||||
# Scan a line and see if it has an error
|
||||
#
|
||||
sub has_error {
|
||||
$line =~ /fatal error/ # link error
|
||||
|| $line =~ / error / # C error
|
||||
|| $line =~ /^C / # cvs merge conflict
|
||||
|| $line =~ /error C/ # C error
|
||||
|| $line =~ /Creating new precompiled header/ # Wastes time.
|
||||
|| $line =~ /error:/ # java error
|
||||
|| $line =~ /jmake.MakerFailedException:/ # java error
|
||||
|| $line =~ /Unknown host / # cvs error
|
||||
|| $line =~ /: build failed\;/ # nmake error
|
||||
|| ($line =~ /gmake/ && $line =~ / Error /)
|
||||
|| $line =~ /\[checkout aborted\]/ #cvs error
|
||||
|| $line =~ /\: cannot find module/ #cvs error
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
sub has_warning {
|
||||
$line =~ /: warning/ # link error
|
||||
|| $line =~ / error / # C error
|
||||
;
|
||||
}
|
||||
|
||||
sub has_errorline {
|
||||
local( $line ) = @_;
|
||||
$error_file = ''; #'NS\CMD\WINFE\CXICON.cpp';
|
||||
$error_line = 0;
|
||||
|
||||
if( $line =~ m@(ns([\\/][a-z0-9\._]+)*)@i ){
|
||||
$error_file = $1;
|
||||
$error_file_ref = lc $error_file;
|
||||
$error_file_ref =~ s@\\@/@g;
|
||||
|
||||
$line =~ m/\(([0-9]+)\)/;
|
||||
$error_line = $1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( $line =~ m@(^([A-Za-z0-9_]+\.[A-Za-z])+\(([0-9]+)\))@ ){
|
||||
$error_file = $1;
|
||||
$error_file_ref = lc $2;
|
||||
$error_line = $3;
|
||||
$error_guess=1;
|
||||
$error_file_ref =~ s@\\@/@g;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
44
mozilla/webtools/tinderbox/examples/README
Normal file
44
mozilla/webtools/tinderbox/examples/README
Normal file
@@ -0,0 +1,44 @@
|
||||
This directory contains example Tinderbox client scripts. These scripts are
|
||||
for illustration/documentation purposes only and are not maintained
|
||||
regularly. Current scripts to build mozilla will live in an another spot
|
||||
in the mozilla tree.
|
||||
|
||||
Three examples have been provided:
|
||||
|
||||
mozilla-windows.pl: perl script that drives mozilla tinderbox builds for Win32
|
||||
mozilla-unix.pl : perl script that drives mozilla tinderbox builds for UNIX
|
||||
build-moz-smoke.pl: perl script that drives mozilla tinderbox builds for UNIX,
|
||||
and subsequently runs the executable returning a green tree only if
|
||||
it does not crash.
|
||||
|
||||
These scripts show the basic elements of a Tinderbox client script. These
|
||||
elements are:
|
||||
|
||||
1) Sending a start e-mail to the Tinderbox server, in the form of a formatted
|
||||
mail message. Example:
|
||||
|
||||
tinderbox: tree: Mozilla
|
||||
tinderbox: builddate: 900002087
|
||||
tinderbox: status: building
|
||||
tinderbox: build: IRIX 6.3 Depend
|
||||
tinderbox: errorparser: unix
|
||||
tinderbox: buildfamily: unix
|
||||
|
||||
2) Obtain a source tree by performing a cvs checkout.
|
||||
|
||||
3) Perform the build, saving the output to a log file.
|
||||
|
||||
4) Determine if the build was successful or failed. This could be done either
|
||||
by checking for the presence of a binary, or being using error codes returned
|
||||
from the compile command.
|
||||
|
||||
5) Send a completion message to Tinderbox, identifying build success or
|
||||
failure. Example:
|
||||
|
||||
tinderbox: tree: Mozilla
|
||||
tinderbox: builddate: 900002087
|
||||
tinderbox: status: success
|
||||
tinderbox: build: IRIX 6.3 Depend
|
||||
tinderbox: errorparser: unix
|
||||
tinderbox: buildfamily: unix
|
||||
|
||||
594
mozilla/webtools/tinderbox/examples/build-moz-smoke.pl
Executable file
594
mozilla/webtools/tinderbox/examples/build-moz-smoke.pl
Executable file
@@ -0,0 +1,594 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
require 5.000;
|
||||
|
||||
use Sys::Hostname;
|
||||
use POSIX "sys_wait_h";
|
||||
use Cwd;
|
||||
|
||||
$Version = "1.000";
|
||||
|
||||
sub InitVars {
|
||||
|
||||
# PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
$BuildAdministrator = "$ENV{'USER'}\@$ENV{'HOST'}";
|
||||
|
||||
#Default values of cmdline opts
|
||||
$BuildDepend = 1; #depend or clobber
|
||||
$ReportStatus = 1; # Send results to server or not
|
||||
$BuildOnce = 0; # Build once, don't send results to server
|
||||
$BuildClassic = 0; # Build classic source
|
||||
|
||||
#relative path to binary
|
||||
$BinaryName{'x'} = 'mozilla-export';
|
||||
$BinaryName{'qt'} = 'qtmozilla-export';
|
||||
$BinaryName{'gnome'} = 'gnuzilla-export';
|
||||
$BinaryName{'webshell'} = '/webshell/tests/viewer/viewer';
|
||||
|
||||
# Set these to what makes sense for your system
|
||||
$cpus = 1;
|
||||
$Make = 'gmake'; # Must be gnu make
|
||||
$mail = '/bin/mail';
|
||||
$Autoconf = 'autoconf -l build/autoconf';
|
||||
$CVS = 'cvs -z3';
|
||||
$CVSCO = 'co -P';
|
||||
|
||||
# Set these proper values for your tinderbox server
|
||||
$Tinderbox_server = 'tinderbox-daemon\@cvs-mirror.mozilla.org';
|
||||
#$Tinderbox_server = 'external-tinderbox-incoming\@tinderbox.seawood.org';
|
||||
|
||||
# These shouldn't really need to be changed
|
||||
$BuildSleep = 10; # Minimum wait period from start of build to start
|
||||
# of next build in minutes
|
||||
$BuildTree = 'SeaMonkey';
|
||||
$BuildTag = '';
|
||||
$BuildName = '';
|
||||
$TopLevel = '.';
|
||||
$Topsrcdir = 'mozilla';
|
||||
$BuildObjName = '';
|
||||
$BuildConfigDir = 'mozilla/config';
|
||||
$ClobberStr = 'realclean';
|
||||
$ConfigureEnvArgs = 'CFLAGS=-pipe CXXFLAGS=-pipe';
|
||||
#$ConfigureEnvArgs = '';
|
||||
$ConfigureArgs = "--with-nspr=/usr/local/nspr --cache-file=/dev/null --with-static-gtk --enable-editor";
|
||||
$ConfigGuess = './build/autoconf/config.guess';
|
||||
$Logfile = '${BuildDir}.log';
|
||||
} #EndSub-InitVars
|
||||
|
||||
sub ConditionalArgs {
|
||||
if ( $BuildClassic ) {
|
||||
$FE = 'x';
|
||||
$ConfigureArgs .= " --enable-fe=$FE";
|
||||
# $BuildTree = 'raptor';
|
||||
$BuildModule = 'Raptor';
|
||||
$BuildTag = ''
|
||||
if ($BuildTag eq '');
|
||||
$TopLevel = "mozilla-classic";
|
||||
} else {
|
||||
# $BuildTree = 'raptor';
|
||||
# $Toolkit = 'gtk';
|
||||
$FE = 'webshell';
|
||||
# $BuildModule = 'Raptor';
|
||||
$BuildModule = 'SeaMonkeyAll';
|
||||
# $ConfigureArgs .= " --enable-toolkit=$Toolkit";
|
||||
}
|
||||
$CVSCO .= " -r $BuildTag" if ( $BuildTag ne '');
|
||||
}
|
||||
sub SetupEnv {
|
||||
umask(0);
|
||||
$ENV{"CVSROOT"} = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot';
|
||||
$ENV{"LD_LIBRARY_PATH"} = '/usr/local/nspr:/builds/tinderbox/SeaMonkey/Linux_2.0.34_clobber/mozilla/obj-i586-pc-linux-gnu/dist/bin:/usr/lib/png:/usr/local/lib';
|
||||
$ENV{"DISPLAY"} = 'crucible.mcom.com:0.0';
|
||||
} #EndSub-SetupEnv
|
||||
|
||||
sub SetupPath {
|
||||
my($Path);
|
||||
$Path = $ENV{PATH};
|
||||
print "Path before: $Path\n";
|
||||
|
||||
if ( $OS eq 'SunOS' ) {
|
||||
$ENV{'PATH'} = '/usr/ccs/bin:' . $ENV{'PATH'};
|
||||
}
|
||||
|
||||
$Path = $ENV{PATH};
|
||||
print "Path After: $Path\n";
|
||||
} #EndSub-SetupPath
|
||||
|
||||
##########################################################################
|
||||
# NO USER CONFIGURABLE PIECES BEYOND THIS POINT #
|
||||
##########################################################################
|
||||
|
||||
sub GetSystemInfo {
|
||||
|
||||
$OS = `uname -s`;
|
||||
$OSVer = `uname -r`;
|
||||
|
||||
chop($OS, $OSVer);
|
||||
|
||||
if ( $OS eq 'AIX' ) {
|
||||
$OSVer = `uname -v`;
|
||||
chop($OSVer);
|
||||
$OSVer = $OSVer . "." . `uname -r`;
|
||||
chop($OSVer);
|
||||
}
|
||||
|
||||
if ( $OS eq 'IRIX64' ) {
|
||||
$OS = 'IRIX';
|
||||
}
|
||||
|
||||
if ( $OS eq 'SCO_SV' ) {
|
||||
$OS = 'SCOOS';
|
||||
$OSVer = '5.0';
|
||||
}
|
||||
|
||||
my $host, $myhost = hostname;
|
||||
chomp($myhost);
|
||||
($host, $junk) = split(/\./, $myhost);
|
||||
|
||||
$BuildName = "";
|
||||
|
||||
if ( "$host" ne "" ) {
|
||||
$BuildName = $host . ' ';
|
||||
}
|
||||
$BuildName .= $OS . ' ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
||||
$DirName = $OS . '_' . $OSVer . '_' . ($BuildDepend?'depend':'clobber');
|
||||
|
||||
$RealOS = $OS;
|
||||
$RealOSVer = $OSVer;
|
||||
|
||||
if ( $OS eq 'HP-UX' ) {
|
||||
$RealOSVer = substr($OSVer,0,4);
|
||||
}
|
||||
|
||||
if ( $OS eq 'Linux' ) {
|
||||
$RealOSVer = substr($OSVer,0,3);
|
||||
}
|
||||
|
||||
if ($BuildClassic) {
|
||||
$logfile = "${DirName}-classic.log";
|
||||
} else {
|
||||
$logfile = "${DirName}.log";
|
||||
}
|
||||
} #EndSub-GetSystemInfo
|
||||
|
||||
sub BuildIt {
|
||||
my ($fe, @felist, $EarlyExit, $LastTime, $StartTimeStr);
|
||||
|
||||
mkdir("$DirName", 0777);
|
||||
chdir("$DirName") || die "Couldn't enter $DirName";
|
||||
|
||||
$StartDir = getcwd();
|
||||
$LastTime = 0;
|
||||
|
||||
print "Starting dir is : $StartDir\n";
|
||||
|
||||
$EarlyExit = 0;
|
||||
|
||||
while ( ! $EarlyExit ) {
|
||||
chdir("$StartDir");
|
||||
if ( time - $LastTime < (60 * $BuildSleep) ) {
|
||||
$SleepTime = (60 * $BuildSleep) - (time - $LastTime);
|
||||
print "\n\nSleeping $SleepTime seconds ...\n";
|
||||
sleep($SleepTime);
|
||||
}
|
||||
|
||||
$LastTime = time;
|
||||
|
||||
$StartTime = time - 60 * 10;
|
||||
$StartTimeStr = &CVSTime($StartTime);
|
||||
|
||||
&StartBuild if ($ReportStatus);
|
||||
$CurrentDir = getcwd();
|
||||
if ( $CurrentDir ne $StartDir ) {
|
||||
print "startdir: $StartDir, curdir $CurrentDir\n";
|
||||
die "curdir != startdir";
|
||||
}
|
||||
|
||||
$BuildDir = $CurrentDir;
|
||||
|
||||
unlink( "$logfile" );
|
||||
|
||||
print "opening $logfile\n";
|
||||
open( LOG, ">$logfile" ) || print "can't open $?\n";
|
||||
print LOG "current dir is -- $hostname:$CurrentDir\n";
|
||||
print LOG "Build Administrator is $BuildAdministrator\n";
|
||||
&PrintEnv;
|
||||
|
||||
$BuildStatus = 0;
|
||||
|
||||
mkdir($TopLevel, 0777);
|
||||
chdir($TopLevel) || die "chdir($TopLevel): $!\n";
|
||||
|
||||
if ( $BuildClassic ) {
|
||||
print"$CVS $CVSCO $BuildModule\n";
|
||||
print LOG "$CVS $CVSCO $BuildModule\n";
|
||||
open (PULL, "$CVS $CVSCO $BuildModule 2>&1 |") || die "open: $!\n";
|
||||
} else {
|
||||
# print "$CVS $CVSCO mozilla/nglayout.mk\n";
|
||||
# print LOG "$CVS $CVSCO mozilla/nglayout.mk\n";
|
||||
# open (PULL, "$CVS $CVSCO mozilla/nglayout.mk 2>&1 |") || die "open: $!\n";
|
||||
print "$CVS $CVSCO mozilla/client.mk\n";
|
||||
print LOG "$CVS $CVSCO mozilla/client.mk\n";
|
||||
open (PULL, "$CVS $CVSCO mozilla/client.mk 2>&1 |") || die "open: $!\n";
|
||||
}
|
||||
while (<PULL>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(PULL);
|
||||
|
||||
# Move to topsrcdir
|
||||
#chdir($Topsrcdir) || die "chdir($Topsrcdir): $!\n";
|
||||
|
||||
|
||||
# Do a separate checkout with toplevel makefile
|
||||
if (! $BuildClassic) {
|
||||
# print LOG "$Make -f nglayout.mk pull_all CVSCO='$CVS $CVSCO'|\n";
|
||||
# open (PULLALL, "$Make -f nglayout.mk pull_all CVSCO='$CVS $CVSCO' |\n");
|
||||
print LOG "$Make -f mozilla/client.mk checkout CVSCO='$CVS $CVSCO'|\n";
|
||||
open (PULLALL, "$Make -f mozilla/client.mk checkout CVSCO='$CVS $CVSCO' |\n");
|
||||
while (<PULLALL>) {
|
||||
print LOG $_;
|
||||
print $_;
|
||||
}
|
||||
close(PULLALL);
|
||||
}
|
||||
|
||||
chdir($Topsrcdir) || die "chdir($Topsrcdir): $!\n";
|
||||
|
||||
print LOG "$Autoconf\n";
|
||||
open (AUTOCONF, "$Autoconf 2>&1 | ") || die "$Autoconf: $!\n";
|
||||
while (<AUTOCONF>) {
|
||||
print LOG $_;
|
||||
print $_;
|
||||
}
|
||||
close(AUTOCONF);
|
||||
|
||||
print LOG "$ConfigGuess\n";
|
||||
$BuildObjName = "obj-";
|
||||
open (GETOBJ, "$ConfigGuess 2>&1 |") || die "$ConfigGuess: $!\n";
|
||||
while (<GETOBJ>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
chomp($BuildObjName .= $_);
|
||||
}
|
||||
close (GETOBJ);
|
||||
|
||||
mkdir($BuildObjName, 0777);
|
||||
chdir($BuildObjName) || die "chdir($BuildObjName): $!\n";
|
||||
|
||||
print LOG "$ConfigureEnvArgs ../configure $ConfigureArgs\n";
|
||||
open (CONFIGURE, "$ConfigureEnvArgs ../configure $ConfigureArgs 2>&1 |") || die "../configure: $!\n";
|
||||
while (<CONFIGURE>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(CONFIGURE);
|
||||
|
||||
# if we are building depend, rebuild dependencies
|
||||
|
||||
if ($BuildDepend) {
|
||||
print LOG "$Make MAKE='$Make -j $cpus' depend 2>&1 |\n";
|
||||
open ( MAKEDEPEND, "$Make MAKE='$Make -j $cpus' depend 2>&1 |\n");
|
||||
while ( <MAKEDEPEND> ) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close (MAKEDEPEND);
|
||||
system("rm -rf dist");
|
||||
|
||||
} else {
|
||||
# Building clobber
|
||||
print LOG "$Make MAKE='$Make -j $cpus' $ClobberStr 2>&1 |\n";
|
||||
open( MAKECLOBBER, "$Make MAKE='$Make -j $cpus' $ClobberStr 2>&1 |");
|
||||
while ( <MAKECLOBBER> ) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close( MAKECLOBBER );
|
||||
}
|
||||
|
||||
@felist = split(/,/, $FE);
|
||||
|
||||
foreach $fe ( @felist ) {
|
||||
if (&BinaryExists($fe)) {
|
||||
print LOG "deleting existing binary\n";
|
||||
&DeleteBinary($fe);
|
||||
}
|
||||
}
|
||||
|
||||
if ($BuildClassic) {
|
||||
# Build the BE only
|
||||
print LOG "$Make MAKE='$Make -j $cpus' MOZ_FE= 2>&1 |\n";
|
||||
open( BEBUILD, "$Make MAKE='$Make -j $cpus' MOZ_FE= 2>&1 |");
|
||||
|
||||
while ( <BEBUILD> ) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close( BEBUILD );
|
||||
|
||||
foreach $fe ( @felist ) {
|
||||
# Now build each front end
|
||||
print LOG "$Make MAKE='$Make -j $cpus' -C cmd/${fe}fe 2>&1 |\n";
|
||||
open(FEBUILD, "$Make MAKE='$Make -j $cpus' -C cmd/${fe}fe 2>&1 |\n");
|
||||
while (<FEBUILD>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(FEBUILD);
|
||||
}
|
||||
} else {
|
||||
print LOG "$Make MAKE='$Make -j $cpus' 2>&1 |\n";
|
||||
open(BUILD, "$Make MAKE='$Make -j $cpus' 2>&1 |\n");
|
||||
while (<BUILD>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(BUILD);
|
||||
}
|
||||
|
||||
foreach $fe (@felist) {
|
||||
if (&BinaryExists($fe)) {
|
||||
print LOG "export binary exists, build successful. Testing...\n";
|
||||
#return 0 if no problem, else 333 for a runtime error
|
||||
$BuildStatus = &RunSmokeTest($fe);
|
||||
}
|
||||
else {
|
||||
print LOG "export binary missing, build FAILED\n";
|
||||
$BuildStatus = 666;
|
||||
}
|
||||
|
||||
if ( $BuildStatus == 0 ) {
|
||||
$BuildStatusStr = 'success';
|
||||
}
|
||||
elsif ( $BuildStatus == 333 ) {
|
||||
$BuildStatusStr = 'testfailed';
|
||||
}
|
||||
else {
|
||||
$BuildStatusStr = 'busted';
|
||||
}
|
||||
# replaced by above lines
|
||||
# $BuildStatusStr = ( $BuildStatus ? 'busted' : 'success' );
|
||||
|
||||
print LOG "tinderbox: tree: $BuildTree\n";
|
||||
print LOG "tinderbox: builddate: $StartTime\n";
|
||||
print LOG "tinderbox: status: $BuildStatusStr\n";
|
||||
print LOG "tinderbox: build: $BuildName $fe\n";
|
||||
print LOG "tinderbox: errorparser: unix\n";
|
||||
print LOG "tinderbox: buildfamily: unix\n";
|
||||
print LOG "tinderbox: END\n";
|
||||
}
|
||||
close(LOG);
|
||||
chdir("$StartDir");
|
||||
|
||||
# this fun line added on 2/5/98. do not remove. Translated to english,
|
||||
# that's "take any line longer than 1000 characters, and split it into less
|
||||
# than 1000 char lines. If any of the resulting lines is
|
||||
# a dot on a line by itself, replace that with a blank line."
|
||||
# This is to prevent cases where a <cr>.<cr> occurs in the log file. Sendmail
|
||||
# interprets that as the end of the mail, and truncates the log before
|
||||
# it gets to Tinderbox. (terry weismann, chris yeh)
|
||||
#
|
||||
# This was replaced by a perl 'port' of the above, writen by
|
||||
# preed@netscape.com; good things: no need for system() call, and now it's
|
||||
# all in perl, so we don't have to do OS checking like before.
|
||||
|
||||
open(LOG, "$logfile") || die "Couldn't open logfile: $!\n";
|
||||
open(OUTLOG, ">${logfile}.last") || die "Couldn't open logfile: $!\n";
|
||||
|
||||
while (<LOG>) {
|
||||
$q = 0;
|
||||
|
||||
for (;;) {
|
||||
$val = $q * 1000;
|
||||
$Output = substr($_, $val, 1000);
|
||||
|
||||
last if $Output eq undef;
|
||||
|
||||
$Output =~ s/^\.$//g;
|
||||
$Output =~ s/\n//g;
|
||||
print OUTLOG "$Output\n";
|
||||
$q++;
|
||||
} #EndFor
|
||||
|
||||
} #EndWhile
|
||||
|
||||
close(LOG);
|
||||
close(OUTLOG);
|
||||
|
||||
system( "$mail $Tinderbox_server < ${logfile}.last" )
|
||||
if ($ReportStatus );
|
||||
unlink("$logfile");
|
||||
|
||||
# if this is a test run, set early_exit to 0.
|
||||
#This mean one loop of execution
|
||||
$EarlyExit++ if ($BuildOnce);
|
||||
}
|
||||
|
||||
} #EndSub-BuildIt
|
||||
|
||||
sub CVSTime {
|
||||
my($StartTimeArg) = @_;
|
||||
my($RetTime, $StartTimeArg, $sec, $minute, $hour, $mday, $mon, $year);
|
||||
|
||||
($sec,$minute,$hour,$mday,$mon,$year) = localtime($StartTimeArg);
|
||||
$mon++; # month is 0 based.
|
||||
|
||||
sprintf("%02d/%02d/%02d %02d:%02d:00", $mon,$mday,$year,$hour,$minute );
|
||||
}
|
||||
|
||||
sub StartBuild {
|
||||
|
||||
my($fe, @felist);
|
||||
|
||||
@felist = split(/,/, $FE);
|
||||
|
||||
# die "SERVER: " . $Tinderbox_server . "\n";
|
||||
open( LOG, "|$mail $Tinderbox_server" );
|
||||
foreach $fe ( @felist ) {
|
||||
print LOG "\n";
|
||||
print LOG "tinderbox: tree: $BuildTree\n";
|
||||
print LOG "tinderbox: builddate: $StartTime\n";
|
||||
print LOG "tinderbox: status: building\n";
|
||||
print LOG "tinderbox: build: $BuildName $fe\n";
|
||||
print LOG "tinderbox: errorparser: unix\n";
|
||||
print LOG "tinderbox: buildfamily: unix\n";
|
||||
print LOG "tinderbox: END\n";
|
||||
print LOG "\n";
|
||||
}
|
||||
close( LOG );
|
||||
}
|
||||
|
||||
# check for the existence of the binary
|
||||
sub BinaryExists {
|
||||
my($fe) = @_;
|
||||
my($Binname);
|
||||
$fe = 'x' if (!defined($fe));
|
||||
|
||||
if ($BuildClassic) {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/'. $BuildObjName . "/cmd/${fe}fe/" . $BinaryName{"$fe"};
|
||||
} else {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
||||
}
|
||||
print LOG $BinName . "\n";
|
||||
if ((-e $BinName) && (-x $BinName) && (-s $BinName)) {
|
||||
1;
|
||||
}
|
||||
else {
|
||||
0;
|
||||
}
|
||||
}
|
||||
|
||||
sub DeleteBinary {
|
||||
my($fe) = @_;
|
||||
my($BinName);
|
||||
$fe = 'x' if (!defined($fe));
|
||||
|
||||
if ($BuildClassic) {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . "/cmd/${fe}fe/" . $BinaryName{"$fe"};
|
||||
} else {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
||||
}
|
||||
print LOG "unlinking $BinName\n";
|
||||
unlink ($BinName) || print LOG "unlinking $BinName failed\n";
|
||||
}
|
||||
|
||||
sub ParseArgs {
|
||||
my($i, $manArg);
|
||||
|
||||
if( @ARGV == 0 ) {
|
||||
&PrintUsage;
|
||||
}
|
||||
$i = 0;
|
||||
$manArg = 0;
|
||||
while( $i < @ARGV ) {
|
||||
if ($ARGV[$i] eq '--depend') {
|
||||
$BuildDepend = 1;
|
||||
$manArg++;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--clobber') {
|
||||
$BuildDepend = 0;
|
||||
$manArg++;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--once' ) {
|
||||
$BuildOnce = 1;
|
||||
#$ReportStatus = 0;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--classic') {
|
||||
$BuildClassic = 1;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--noreport') {
|
||||
$ReportStatus = 0;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--version' || $ARGV[$i] eq '-v') {
|
||||
die "$0: version $Version\n";
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '-tag' ) {
|
||||
$i++;
|
||||
$BuildTag = $ARGV[$i];
|
||||
if ( $BuildTag eq '' || $BuildTag eq '-t') {
|
||||
&PrintUsage;
|
||||
}
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '-t' ) {
|
||||
$i++;
|
||||
$BuildTree = $ARGV[$i];
|
||||
if ( $BuildTree eq '' ) {
|
||||
&PrintUsage;
|
||||
}
|
||||
} else {
|
||||
&PrintUsage;
|
||||
}
|
||||
|
||||
$i++;
|
||||
} #EndWhile
|
||||
|
||||
if ( $BuildTree =~ /^\s+$/i ) {
|
||||
&PrintUsage;
|
||||
}
|
||||
|
||||
if ($BuildDepend eq undef) {
|
||||
&PrintUsage;
|
||||
}
|
||||
|
||||
&PrintUsage if (! $manArg );
|
||||
|
||||
} #EndSub-ParseArgs
|
||||
|
||||
sub PrintUsage {
|
||||
die "usage: $0 [--depend | --clobber] [-v | --version ] [--once --classic --noreport -tag TREETAG -t TREENAME ]\n";
|
||||
}
|
||||
|
||||
sub PrintEnv {
|
||||
my ($key);
|
||||
foreach $key (keys %ENV) {
|
||||
print LOG "$key = $ENV{$key}\n";
|
||||
print "$key = $ENV{$key}\n";
|
||||
}
|
||||
} #EndSub-PrintEnv
|
||||
|
||||
sub RunSmokeTest {
|
||||
my($fe) = @_;
|
||||
my($Binary);
|
||||
$fe = 'x' if (!defined($fe));
|
||||
|
||||
$Binary = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
||||
print LOG $BinName . "\n";
|
||||
|
||||
$waittime = 30;
|
||||
|
||||
$pid = fork;
|
||||
|
||||
exec $Binary if !$pid;
|
||||
|
||||
# parent - wait $waittime seconds then check on child
|
||||
sleep $waittime;
|
||||
$status = waitpid $pid, WNOHANG();
|
||||
if ($status != 0) {
|
||||
print LOG "$BinName has crashed or quit. Turn the tree orange now.\n";
|
||||
return 333;
|
||||
}
|
||||
|
||||
print LOG "Success! $BinName is still running. Killing..\n";
|
||||
# try to kill 3 times, then try a kill -9
|
||||
for ($i=0 ; $i<3 ; $i++) {
|
||||
kill 'TERM',$pid,;
|
||||
# give it 3 seconds to actually die
|
||||
sleep 3;
|
||||
$status = waitpid $pid, WNOHANG();
|
||||
last if ($status != 0);
|
||||
}
|
||||
return 0;
|
||||
} #EndSub-RunSmokeTest
|
||||
|
||||
# Main function
|
||||
&InitVars;
|
||||
&ParseArgs;
|
||||
&ConditionalArgs;
|
||||
&GetSystemInfo;
|
||||
&SetupEnv;
|
||||
&SetupPath;
|
||||
&BuildIt;
|
||||
|
||||
1;
|
||||
63
mozilla/webtools/tinderbox/examples/buildit.config
Executable file
63
mozilla/webtools/tinderbox/examples/buildit.config
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
sub InitVars {
|
||||
|
||||
#initialize variables
|
||||
#$binary_name = '/netscape-export';
|
||||
$BinaryName = '/mozilla-export';
|
||||
$BuildDepend = 1; #depend or clobber
|
||||
$BuildTree = '';
|
||||
$BuildTag = '';
|
||||
$BuildName = '';
|
||||
#$BuildContinue = 0;
|
||||
$TopLevel = 'mozilla/';
|
||||
$BuildObjName = '';
|
||||
$BuildSleep = 10;
|
||||
$BuildUnixclasses = 0;
|
||||
$EarlyExit = 1;
|
||||
$BuildStartDir = 'ns/';
|
||||
$BuildConfigDir = 'mozilla/config';
|
||||
|
||||
} #EndSub-InitVars
|
||||
|
||||
sub SetupEnv {
|
||||
|
||||
umask(0);
|
||||
$ENV{'MOZILLA_CLIENT'} = 1;
|
||||
$ENV{'NETSCAPE_HIERARCHY'} = 1;
|
||||
$ENV{'BUILD_OFFICIAL'} = 1;
|
||||
$ENV{'NSPR20'} = 1;
|
||||
$ENV{'AWT_11'} = 1;
|
||||
$ENV{'MOZ_SECURITY'} = 1;
|
||||
$ENV{"CVSROOT"} = '/m/src';
|
||||
$ENV{"MAKE"} = 'gmake -e';
|
||||
$ENV{'MOZ_MEDIUM'} = 1;
|
||||
$ENV{'NO_MDUPDATE'} = 1;
|
||||
$ENV{'EDITOR'} = 1;
|
||||
|
||||
} #EndSub-SetupEnv
|
||||
|
||||
sub SetupPath {
|
||||
|
||||
my($Path);
|
||||
$Path = $ENV{PATH};
|
||||
print "Path before: $Path\n";
|
||||
$ENV{'PATH'} = '/tools/ns/bin:/tools/contrib/bin:/usr/local/bin:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/bin/X11:/usr/etc:/usr/hosts:/usr/ucb:';
|
||||
|
||||
# This won't work on x86 or sunos4 systems....
|
||||
if ( $OS eq 'SunOS' ) {
|
||||
$ENV{'PATH'} = '/usr/ccs/bin:/tools/ns/soft/gcc-2.6.3/run/default/sparc_sun_solaris2.4/bin:' . $ENV{'PATH'};
|
||||
$ENV{'NO_MDUPDATE'} = 1;
|
||||
}
|
||||
|
||||
if ( $OS eq 'AIX' ) {
|
||||
$ENV{'PATH'} = $ENV{'PATH'} . '/usr/lpp/xlC/bin:/usr/local-aix/bin:';
|
||||
}
|
||||
|
||||
$Path = $ENV{PATH};
|
||||
print "Path After: $Path\n";
|
||||
|
||||
} #EndSub-SetupPath
|
||||
|
||||
|
||||
1;
|
||||
548
mozilla/webtools/tinderbox/examples/mozilla-unix.pl
Executable file
548
mozilla/webtools/tinderbox/examples/mozilla-unix.pl
Executable file
@@ -0,0 +1,548 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
require 5.000;
|
||||
|
||||
use Sys::Hostname;
|
||||
use Cwd;
|
||||
|
||||
$Version = "1.000";
|
||||
|
||||
sub InitVars {
|
||||
|
||||
# PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
$BuildAdministrator = "$ENV{'USER'}\@$ENV{'HOST'}";
|
||||
|
||||
#Default values of cmdline opts
|
||||
$BuildDepend = 1; #depend or clobber
|
||||
$ReportStatus = 1; # Send results to server or not
|
||||
$BuildOnce = 0; # Build once, don't send results to server
|
||||
$BuildClassic = 0; # Build classic source
|
||||
|
||||
#relative path to binary
|
||||
$BinaryName{'x'} = 'mozilla-export';
|
||||
$BinaryName{'qt'} = 'qtmozilla-export';
|
||||
$BinaryName{'gnome'} = 'gnuzilla-export';
|
||||
$BinaryName{'webshell'} = '/webshell/tests/viewer/viewer';
|
||||
$BinaryName{'xpfe'} = '/xpfe/xpviewer/src/xpviewer';
|
||||
|
||||
# Set these to what makes sense for your system
|
||||
$cpus = 1;
|
||||
$Make = 'gmake'; # Must be gnu make
|
||||
$mail = '/bin/mail';
|
||||
$Autoconf = 'autoconf -l build/autoconf';
|
||||
$CVS = 'cvs -z3';
|
||||
$CVSCO = 'co -P';
|
||||
|
||||
# Set these proper values for your tinderbox server
|
||||
$Tinderbox_server = 'tinderbox-daemon\@warp.mcom.com';
|
||||
#$Tinderbox_server = 'external-tinderbox-incoming\@tinderbox.seawood.org';
|
||||
|
||||
# These shouldn't really need to be changed
|
||||
$BuildSleep = 10; # Minimum wait period from start of build to start
|
||||
# of next build in minutes
|
||||
$BuildTree = 'raptor';
|
||||
$BuildTag = '';
|
||||
$BuildName = '';
|
||||
$TopLevel = '.';
|
||||
$Topsrcdir = 'mozilla';
|
||||
$BuildObjName = '';
|
||||
$BuildConfigDir = 'mozilla/config';
|
||||
$ClobberStr = 'realclean';
|
||||
$ConfigureEnvArgs = 'CFLAGS=-pipe CXXFLAGS=-pipe';
|
||||
#$ConfigureEnvArgs = '';
|
||||
$ConfigureArgs = "--cache-file=/dev/null";
|
||||
$ConfigGuess = './build/autoconf/config.guess';
|
||||
$Logfile = '${BuildDir}.log';
|
||||
} #EndSub-InitVars
|
||||
|
||||
sub ConditionalArgs {
|
||||
if ( $BuildClassic ) {
|
||||
$FE = 'x';
|
||||
$ConfigureArgs .= " --enable-fe=$FE";
|
||||
$BuildTree = 'raptor';
|
||||
$BuildModule = 'Raptor';
|
||||
$BuildTag = ''
|
||||
if ($BuildTag eq '');
|
||||
$TopLevel = "mozilla-classic";
|
||||
} else {
|
||||
$BuildTree = 'raptor';
|
||||
# $Toolkit = 'gtk';
|
||||
$FE = 'webshell,xpfe';
|
||||
$BuildModule = 'Raptor';
|
||||
# $ConfigureArgs .= " --enable-toolkit=$Toolkit";
|
||||
}
|
||||
$CVSCO .= " -r $BuildTag" if ( $BuildTag ne '');
|
||||
}
|
||||
sub SetupEnv {
|
||||
umask(0);
|
||||
$ENV{"CVSROOT"} = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot';
|
||||
} #EndSub-SetupEnv
|
||||
|
||||
sub SetupPath {
|
||||
my($Path);
|
||||
$Path = $ENV{PATH};
|
||||
print "Path before: $Path\n";
|
||||
|
||||
if ( $OS eq 'SunOS' ) {
|
||||
$ENV{'PATH'} = '/usr/ccs/bin:' . $ENV{'PATH'};
|
||||
}
|
||||
|
||||
$Path = $ENV{PATH};
|
||||
print "Path After: $Path\n";
|
||||
} #EndSub-SetupPath
|
||||
|
||||
##########################################################################
|
||||
# NO USER CONFIGURABLE PIECES BEYOND THIS POINT #
|
||||
##########################################################################
|
||||
|
||||
sub GetSystemInfo {
|
||||
|
||||
$OS = `uname -s`;
|
||||
$OSVer = `uname -r`;
|
||||
|
||||
chop($OS, $OSVer);
|
||||
|
||||
if ( $OS eq 'AIX' ) {
|
||||
$OSVer = `uname -v`;
|
||||
chop($OSVer);
|
||||
$OSVer = $OSVer . "." . `uname -r`;
|
||||
chop($OSVer);
|
||||
}
|
||||
|
||||
if ( $OS eq 'IRIX64' ) {
|
||||
$OS = 'IRIX';
|
||||
}
|
||||
|
||||
if ( $OS eq 'SCO_SV' ) {
|
||||
$OS = 'SCOOS';
|
||||
$OSVer = '5.0';
|
||||
}
|
||||
|
||||
my $host, $myhost = hostname;
|
||||
chomp($myhost);
|
||||
($host, $junk) = split(/\./, $myhost);
|
||||
|
||||
$BuildName = "";
|
||||
|
||||
if ( "$host" ne "" ) {
|
||||
$BuildName = $host . ' ';
|
||||
}
|
||||
$BuildName .= $OS . ' ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
||||
$DirName = $OS . '_' . $OSVer . '_' . ($BuildDepend?'depend':'clobber');
|
||||
|
||||
$RealOS = $OS;
|
||||
$RealOSVer = $OSVer;
|
||||
|
||||
if ( $OS eq 'HP-UX' ) {
|
||||
$RealOSVer = substr($OSVer,0,4);
|
||||
}
|
||||
|
||||
if ( $OS eq 'Linux' ) {
|
||||
$RealOSVer = substr($OSVer,0,3);
|
||||
}
|
||||
|
||||
if ($BuildClassic) {
|
||||
$logfile = "${DirName}-classic.log";
|
||||
} else {
|
||||
$logfile = "${DirName}.log";
|
||||
}
|
||||
} #EndSub-GetSystemInfo
|
||||
|
||||
sub BuildIt {
|
||||
my ($fe, @felist, $EarlyExit, $LastTime, $StartTimeStr);
|
||||
|
||||
mkdir("$DirName", 0777);
|
||||
chdir("$DirName") || die "Couldn't enter $DirName";
|
||||
|
||||
$StartDir = getcwd();
|
||||
$LastTime = 0;
|
||||
|
||||
print "Starting dir is : $StartDir\n";
|
||||
|
||||
$EarlyExit = 0;
|
||||
|
||||
while ( ! $EarlyExit ) {
|
||||
chdir("$StartDir");
|
||||
if ( time - $LastTime < (60 * $BuildSleep) ) {
|
||||
$SleepTime = (60 * $BuildSleep) - (time - $LastTime);
|
||||
print "\n\nSleeping $SleepTime seconds ...\n";
|
||||
sleep($SleepTime);
|
||||
}
|
||||
|
||||
$LastTime = time;
|
||||
|
||||
$StartTime = time - 60 * 10;
|
||||
$StartTimeStr = &CVSTime($StartTime);
|
||||
|
||||
&StartBuild if ($ReportStatus);
|
||||
$CurrentDir = getcwd();
|
||||
if ( $CurrentDir ne $StartDir ) {
|
||||
print "startdir: $StartDir, curdir $CurrentDir\n";
|
||||
die "curdir != startdir";
|
||||
}
|
||||
|
||||
$BuildDir = $CurrentDir;
|
||||
|
||||
unlink( "$logfile" );
|
||||
|
||||
print "opening $logfile\n";
|
||||
open( LOG, ">$logfile" ) || print "can't open $?\n";
|
||||
print LOG "current dir is -- $hostname:$CurrentDir\n";
|
||||
print LOG "Build Administrator is $BuildAdministrator\n";
|
||||
&PrintEnv;
|
||||
|
||||
$BuildStatus = 0;
|
||||
|
||||
mkdir($TopLevel, 0777);
|
||||
chdir($TopLevel) || die "chdir($TopLevel): $!\n";
|
||||
|
||||
if ( $BuildClassic ) {
|
||||
print"$CVS $CVSCO $BuildModule\n";
|
||||
print LOG "$CVS $CVSCO $BuildModule\n";
|
||||
open (PULL, "$CVS $CVSCO $BuildModule 2>&1 |") || die "open: $!\n";
|
||||
} else {
|
||||
# print "$CVS $CVSCO mozilla/nglayout.mk\n";
|
||||
# print LOG "$CVS $CVSCO mozilla/nglayout.mk\n";
|
||||
# open (PULL, "$CVS $CVSCO mozilla/nglayout.mk 2>&1 |") || die "open: $!\n";
|
||||
print "$CVS $CVSCO mozilla/client.mk\n";
|
||||
print LOG "$CVS $CVSCO mozilla/client.mk\n";
|
||||
open (PULL, "$CVS $CVSCO mozilla/client.mk 2>&1 |") || die "open: $!\n";
|
||||
}
|
||||
while (<PULL>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(PULL);
|
||||
|
||||
# Move to topsrcdir
|
||||
#chdir($Topsrcdir) || die "chdir($Topsrcdir): $!\n";
|
||||
|
||||
|
||||
# Do a separate checkout with toplevel makefile
|
||||
if (! $BuildClassic) {
|
||||
# print LOG "$Make -f nglayout.mk pull_all CVSCO='$CVS $CVSCO'|\n";
|
||||
# open (PULLALL, "$Make -f nglayout.mk pull_all CVSCO='$CVS $CVSCO' |\n");
|
||||
print LOG "$Make -f mozilla/client.mk checkout CVSCO='$CVS $CVSCO'|\n";
|
||||
open (PULLALL, "$Make -f mozilla/client.mk checkout CVSCO='$CVS $CVSCO' |\n");
|
||||
while (<PULLALL>) {
|
||||
print LOG $_;
|
||||
print $_;
|
||||
}
|
||||
close(PULLALL);
|
||||
}
|
||||
|
||||
chdir($Topsrcdir) || die "chdir($Topsrcdir): $!\n";
|
||||
|
||||
print LOG "$Autoconf\n";
|
||||
open (AUTOCONF, "$Autoconf 2>&1 | ") || die "$Autoconf: $!\n";
|
||||
while (<AUTOCONF>) {
|
||||
print LOG $_;
|
||||
print $_;
|
||||
}
|
||||
close(AUTOCONF);
|
||||
|
||||
print LOG "$ConfigGuess\n";
|
||||
$BuildObjName = "obj-";
|
||||
open (GETOBJ, "$ConfigGuess 2>&1 |") || die "$ConfigGuess: $!\n";
|
||||
while (<GETOBJ>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
chomp($BuildObjName .= $_);
|
||||
}
|
||||
close (GETOBJ);
|
||||
|
||||
mkdir($BuildObjName, 0777);
|
||||
chdir($BuildObjName) || die "chdir($BuildObjName): $!\n";
|
||||
|
||||
print LOG "$ConfigureEnvArgs ../configure $ConfigureArgs\n";
|
||||
open (CONFIGURE, "$ConfigureEnvArgs ../configure $ConfigureArgs 2>&1 |") || die "../configure: $!\n";
|
||||
while (<CONFIGURE>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(CONFIGURE);
|
||||
|
||||
# if we are building depend, rebuild dependencies
|
||||
|
||||
if ($BuildDepend) {
|
||||
print LOG "$Make MAKE='$Make -j $cpus' depend 2>&1 |\n";
|
||||
open ( MAKEDEPEND, "$Make MAKE='$Make -j $cpus' depend 2>&1 |\n");
|
||||
while ( <MAKEDEPEND> ) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close (MAKEDEPEND);
|
||||
system("rm -rf dist");
|
||||
|
||||
} else {
|
||||
# Building clobber
|
||||
print LOG "$Make MAKE='$Make -j $cpus' $ClobberStr 2>&1 |\n";
|
||||
open( MAKECLOBBER, "$Make MAKE='$Make -j $cpus' $ClobberStr 2>&1 |");
|
||||
while ( <MAKECLOBBER> ) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close( MAKECLOBBER );
|
||||
}
|
||||
|
||||
@felist = split(/,/, $FE);
|
||||
|
||||
foreach $fe ( @felist ) {
|
||||
if (&BinaryExists($fe)) {
|
||||
print LOG "deleting existing binary\n";
|
||||
&DeleteBinary($fe);
|
||||
}
|
||||
}
|
||||
|
||||
if ($BuildClassic) {
|
||||
# Build the BE only
|
||||
print LOG "$Make MAKE='$Make -j $cpus' MOZ_FE= 2>&1 |\n";
|
||||
open( BEBUILD, "$Make MAKE='$Make -j $cpus' MOZ_FE= 2>&1 |");
|
||||
|
||||
while ( <BEBUILD> ) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close( BEBUILD );
|
||||
|
||||
foreach $fe ( @felist ) {
|
||||
# Now build each front end
|
||||
print LOG "$Make MAKE='$Make -j $cpus' -C cmd/${fe}fe 2>&1 |\n";
|
||||
open(FEBUILD, "$Make MAKE='$Make -j $cpus' -C cmd/${fe}fe 2>&1 |\n");
|
||||
while (<FEBUILD>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(FEBUILD);
|
||||
}
|
||||
} else {
|
||||
print LOG "$Make MAKE='$Make -j $cpus' 2>&1 |\n";
|
||||
open(BUILD, "$Make MAKE='$Make -j $cpus' 2>&1 |\n");
|
||||
while (<BUILD>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close(BUILD);
|
||||
}
|
||||
|
||||
foreach $fe (@felist) {
|
||||
if (&BinaryExists($fe)) {
|
||||
print LOG "export binary exists, build SUCCESSFUL!\n";
|
||||
$BuildStatus = 0;
|
||||
}
|
||||
else {
|
||||
print LOG "export binary missing, build FAILED\n";
|
||||
$BuildStatus = 666;
|
||||
}
|
||||
|
||||
print LOG "\nBuild Status = $BuildStatus\n";
|
||||
|
||||
$BuildStatusStr = ( $BuildStatus ? 'busted' : 'success' );
|
||||
|
||||
print LOG "tinderbox: tree: $BuildTree\n";
|
||||
print LOG "tinderbox: builddate: $StartTime\n";
|
||||
print LOG "tinderbox: status: $BuildStatusStr\n";
|
||||
print LOG "tinderbox: build: $BuildName $fe\n";
|
||||
print LOG "tinderbox: errorparser: unix\n";
|
||||
print LOG "tinderbox: buildfamily: unix\n";
|
||||
print LOG "tinderbox: END\n";
|
||||
}
|
||||
close(LOG);
|
||||
chdir("$StartDir");
|
||||
|
||||
# this fun line added on 2/5/98. do not remove. Translated to english,
|
||||
# that's "take any line longer than 1000 characters, and split it into less
|
||||
# than 1000 char lines. If any of the resulting lines is
|
||||
# a dot on a line by itself, replace that with a blank line."
|
||||
# This is to prevent cases where a <cr>.<cr> occurs in the log file. Sendmail
|
||||
# interprets that as the end of the mail, and truncates the log before
|
||||
# it gets to Tinderbox. (terry weismann, chris yeh)
|
||||
#
|
||||
# This was replaced by a perl 'port' of the above, writen by
|
||||
# preed@netscape.com; good things: no need for system() call, and now it's
|
||||
# all in perl, so we don't have to do OS checking like before.
|
||||
|
||||
open(LOG, "$logfile") || die "Couldn't open logfile: $!\n";
|
||||
open(OUTLOG, ">${logfile}.last") || die "Couldn't open logfile: $!\n";
|
||||
|
||||
while (<LOG>) {
|
||||
$q = 0;
|
||||
|
||||
for (;;) {
|
||||
$val = $q * 1000;
|
||||
$Output = substr($_, $val, 1000);
|
||||
|
||||
last if $Output eq undef;
|
||||
|
||||
$Output =~ s/^\.$//g;
|
||||
$Output =~ s/\n//g;
|
||||
print OUTLOG "$Output\n";
|
||||
$q++;
|
||||
} #EndFor
|
||||
|
||||
} #EndWhile
|
||||
|
||||
close(LOG);
|
||||
close(OUTLOG);
|
||||
|
||||
system( "$mail $Tinderbox_server < ${logfile}.last" )
|
||||
if ($ReportStatus );
|
||||
unlink("$logfile");
|
||||
|
||||
# if this is a test run, set early_exit to 0.
|
||||
#This mean one loop of execution
|
||||
$EarlyExit++ if ($BuildOnce);
|
||||
}
|
||||
|
||||
} #EndSub-BuildIt
|
||||
|
||||
sub CVSTime {
|
||||
my($StartTimeArg) = @_;
|
||||
my($RetTime, $StartTimeArg, $sec, $minute, $hour, $mday, $mon, $year);
|
||||
|
||||
($sec,$minute,$hour,$mday,$mon,$year) = localtime($StartTimeArg);
|
||||
$mon++; # month is 0 based.
|
||||
|
||||
sprintf("%02d/%02d/%02d %02d:%02d:00", $mon,$mday,$year,$hour,$minute );
|
||||
}
|
||||
|
||||
sub StartBuild {
|
||||
|
||||
my($fe, @felist);
|
||||
|
||||
@felist = split(/,/, $FE);
|
||||
|
||||
# die "SERVER: " . $Tinderbox_server . "\n";
|
||||
open( LOG, "|$mail $Tinderbox_server" );
|
||||
foreach $fe ( @felist ) {
|
||||
print LOG "\n";
|
||||
print LOG "tinderbox: tree: $BuildTree\n";
|
||||
print LOG "tinderbox: builddate: $StartTime\n";
|
||||
print LOG "tinderbox: status: building\n";
|
||||
print LOG "tinderbox: build: $BuildName $fe\n";
|
||||
print LOG "tinderbox: errorparser: unix\n";
|
||||
print LOG "tinderbox: buildfamily: unix\n";
|
||||
print LOG "tinderbox: END\n";
|
||||
print LOG "\n";
|
||||
}
|
||||
close( LOG );
|
||||
}
|
||||
|
||||
# check for the existence of the binary
|
||||
sub BinaryExists {
|
||||
my($fe) = @_;
|
||||
my($Binname);
|
||||
$fe = 'x' if (!defined($fe));
|
||||
|
||||
if ($BuildClassic) {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/'. $BuildObjName . "/cmd/${fe}fe/" . $BinaryName{"$fe"};
|
||||
} else {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
||||
}
|
||||
print LOG $BinName . "\n";
|
||||
if ((-e $BinName) && (-x $BinName) && (-s $BinName)) {
|
||||
1;
|
||||
}
|
||||
else {
|
||||
0;
|
||||
}
|
||||
}
|
||||
|
||||
sub DeleteBinary {
|
||||
my($fe) = @_;
|
||||
my($BinName);
|
||||
$fe = 'x' if (!defined($fe));
|
||||
|
||||
if ($BuildClassic) {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . "/cmd/${fe}fe/" . $BinaryName{"$fe"};
|
||||
} else {
|
||||
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
||||
}
|
||||
print LOG "unlinking $BinName\n";
|
||||
unlink ($BinName) || print LOG "unlinking $BinName failed\n";
|
||||
}
|
||||
|
||||
sub ParseArgs {
|
||||
my($i, $manArg);
|
||||
|
||||
if( @ARGV == 0 ) {
|
||||
&PrintUsage;
|
||||
}
|
||||
$i = 0;
|
||||
$manArg = 0;
|
||||
while( $i < @ARGV ) {
|
||||
if ($ARGV[$i] eq '--depend') {
|
||||
$BuildDepend = 1;
|
||||
$manArg++;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--clobber') {
|
||||
$BuildDepend = 0;
|
||||
$manArg++;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--once' ) {
|
||||
$BuildOnce = 1;
|
||||
#$ReportStatus = 0;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--classic') {
|
||||
$BuildClassic = 1;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--noreport') {
|
||||
$ReportStatus = 0;
|
||||
}
|
||||
elsif ($ARGV[$i] eq '--version' || $ARGV[$i] eq '-v') {
|
||||
die "$0: version $Version\n";
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '-tag' ) {
|
||||
$i++;
|
||||
$BuildTag = $ARGV[$i];
|
||||
if ( $BuildTag eq '' || $BuildTag eq '-t') {
|
||||
&PrintUsage;
|
||||
}
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '-t' ) {
|
||||
$i++;
|
||||
$BuildTree = $ARGV[$i];
|
||||
if ( $BuildTree eq '' ) {
|
||||
&PrintUsage;
|
||||
}
|
||||
} else {
|
||||
&PrintUsage;
|
||||
}
|
||||
|
||||
$i++;
|
||||
} #EndWhile
|
||||
|
||||
if ( $BuildTree =~ /^\s+$/i ) {
|
||||
&PrintUsage;
|
||||
}
|
||||
|
||||
if ($BuildDepend eq undef) {
|
||||
&PrintUsage;
|
||||
}
|
||||
|
||||
&PrintUsage if (! $manArg );
|
||||
|
||||
} #EndSub-ParseArgs
|
||||
|
||||
sub PrintUsage {
|
||||
die "usage: $0 [--depend | --clobber] [-v | --version ] [--once --classic --noreport -tag TREETAG -t TREENAME ]\n";
|
||||
}
|
||||
|
||||
sub PrintEnv {
|
||||
my ($key);
|
||||
foreach $key (keys %ENV) {
|
||||
print LOG "$key = $ENV{$key}\n";
|
||||
print "$key = $ENV{$key}\n";
|
||||
}
|
||||
} #EndSub-PrintEnv
|
||||
|
||||
# Main function
|
||||
&InitVars;
|
||||
&ParseArgs;
|
||||
&ConditionalArgs;
|
||||
&GetSystemInfo;
|
||||
&SetupEnv;
|
||||
&SetupPath;
|
||||
&BuildIt;
|
||||
|
||||
1;
|
||||
416
mozilla/webtools/tinderbox/examples/mozilla-windows.pl
Executable file
416
mozilla/webtools/tinderbox/examples/mozilla-windows.pl
Executable file
@@ -0,0 +1,416 @@
|
||||
#!c:/nstools/bin/perl5
|
||||
|
||||
use Cwd;
|
||||
|
||||
$build_depend=1; #depend or clobber
|
||||
$build_tree = '';
|
||||
$build_tag = '';
|
||||
$build_name = '';
|
||||
$build_continue = 0;
|
||||
$build_sleep=10;
|
||||
$no32 = 0;
|
||||
$no16 = 0;
|
||||
$original_path = $ENV{'PATH'};
|
||||
$early_exit = 1;
|
||||
$doawt11 = 0;
|
||||
|
||||
$do_clobber = '';
|
||||
$client_param = 'pull_and_build_all';
|
||||
|
||||
&parse_args;
|
||||
|
||||
if( $build_test ){
|
||||
$build_sleep=1;
|
||||
}
|
||||
|
||||
$dirname = ($build_depend?'dep':'clob');
|
||||
|
||||
|
||||
$logfile = "${dirname}.log";
|
||||
|
||||
if( $build_depend ){
|
||||
$clobber_str = 'depend';
|
||||
}
|
||||
else {
|
||||
$clobber_str = 'clobber_all';
|
||||
}
|
||||
|
||||
|
||||
mkdir("$dirname", 0777);
|
||||
chdir("$dirname") || die "couldn't cd to $dirname";
|
||||
|
||||
$start_dir = cwd;
|
||||
$last_time = 0;
|
||||
|
||||
print "starting dir is :$start_dir\n";
|
||||
|
||||
|
||||
while( $early_exit ){
|
||||
chdir("$start_dir");
|
||||
if( time - $last_time < (60 * $build_sleep) ){
|
||||
$sleep_time = (60 * $build_sleep) - (time - $last_time);
|
||||
print "\n\nSleeping $sleep_time seconds ...\n";
|
||||
sleep( $sleep_time );
|
||||
}
|
||||
$last_time = time;
|
||||
|
||||
$start_time = time-60*10;
|
||||
$start_time_str = &cvs_time( $start_time );
|
||||
# call setup_env here in the loop, to update MOZ_DATE with each pass.
|
||||
# setup_env uses start_time_str for MOZ_DATE.
|
||||
&setup_env;
|
||||
|
||||
|
||||
$cur_dir = cwd;
|
||||
|
||||
if( $cur_dir ne $start_dir ){
|
||||
print "startdir: $start_dir, curdir $cur_dir\n";
|
||||
die "curdir != startdir";
|
||||
}
|
||||
|
||||
# build 32-bit with AWT_11=1
|
||||
&setup32("1");
|
||||
if( !$no32 ){
|
||||
if( !$noawt11 ){
|
||||
&do_build(1,$do_clobber);
|
||||
}
|
||||
}
|
||||
|
||||
if ($build_test) {
|
||||
$early_exit = 0; # stops this while loop after one pass.
|
||||
}
|
||||
if( !$no16 ){
|
||||
|
||||
# build 32-bit with AWT_11=0
|
||||
# necessary before building 16-bit because 16-bit cannot use AWT 1.1 classes
|
||||
&setup32("0");
|
||||
if( !$no32 ){
|
||||
if( !$noawt11 ){
|
||||
&do_build(0,'');
|
||||
} else {
|
||||
&do_build(1,$do_clobber);
|
||||
}
|
||||
}
|
||||
|
||||
&setup16;
|
||||
|
||||
# strip_conf fails to strip any variables from the real environemnt
|
||||
# &strip_config;
|
||||
&do_build(0,'');
|
||||
# &restore_config;
|
||||
}
|
||||
}
|
||||
|
||||
sub copy_win16_dist {
|
||||
|
||||
system 'xcopy w:\ y:\ns\dist /S /E /F';
|
||||
print "COPYCOPYCOPY\n";
|
||||
|
||||
}
|
||||
|
||||
sub build_NSPR20_Win16 {
|
||||
|
||||
&start_build;
|
||||
unlink( "${logname}.last" );
|
||||
rename( "${logname}","${logname}.last");
|
||||
|
||||
print "opening ${logname}\n";
|
||||
open( LOG, ">${logname}" ) || print "can't open $?\n";
|
||||
print LOG "current dir is :$cur_dir\n";
|
||||
|
||||
&print_env;
|
||||
|
||||
chdir("$moz_src/ns/nspr20") || die "couldn't chdir to '$moz_src/ns/nspr20'";
|
||||
print LOG "gmake |\n";
|
||||
open( BUILDNSPR, "gmake 2>&1 |") || print "couldn't execute gmake\n";;
|
||||
|
||||
while( <BUILDNSPR> ) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close ( BUILDNSPR );
|
||||
|
||||
close( LOG );
|
||||
}
|
||||
|
||||
sub setup32 {
|
||||
local ($awt) = @_;
|
||||
|
||||
$ENV{"MOZ_BITS"} = '32';
|
||||
$ENV{"AWT_11"} = $awt;
|
||||
$doawt11 = $awt;
|
||||
|
||||
$ENV{"INCLUDE"} = "$msdev\\include;$msdev\\mfc\\include";
|
||||
$ENV{"LIB"} = "$msdev\\lib;$msdev\\mfc\\lib";
|
||||
$ENV{"PATH"} = $original_path . ";$msdev\\bin";
|
||||
$ENV{"OS_TARGET"} = 'WIN95';
|
||||
$moz_src = $ENV{'MOZ_SRC'} = $start_dir;
|
||||
$build_name = 'Win32 ' . ($build_depend?'Depend':'Clobber');
|
||||
$do_clobber = $clobber_str;
|
||||
$logname = "win32.log";
|
||||
}
|
||||
|
||||
sub setup16 {
|
||||
$moz_src = $ENV{'MOZ_SRC'} = $start_dir;
|
||||
$ENV{"MOZ_BITS"} = '16';
|
||||
# perl 5 is fucked up. you MUST set AWT_11=0. deleting the environment
|
||||
# variable doesn't work. it's removed from the environment entry, but
|
||||
# is still defined as true for a build.
|
||||
$ENV{"AWT_11"} = '0';
|
||||
$moz_src = $ENV{'MOZ_SRC'} = "$src_16_drive";
|
||||
$ENV{"OS_TARGET"} = 'WIN16';
|
||||
|
||||
$msvc_inc = "$moz_src\\ns\\msvc15\\include;$moz_src\\ns\\msvc15\\mfc\\include";
|
||||
$msvc_lib = "$msvc\\lib;$msvc\\mfc\\lib";
|
||||
$msvcpath = "$msvc\\bin;c:\\nstools\\bin;c:\\WINNT40;c:\\WINNT40\\system32;c:\\utils";
|
||||
$ENV{"MSVC_INC"} = $msvc_inc;
|
||||
$ENV{"MSVC_LIB"} = $msvc_lib;
|
||||
$ENV{"MSVCPATH"} = $msvcpath;
|
||||
|
||||
$ENV{"INCLUDE"} = $msvc_inc;
|
||||
$ENV{"LIB"} = $msvc_lib;
|
||||
$ENV{"PATH"} = $msvcpath;
|
||||
|
||||
$watcom = $ENV{"WATCOM"} = "C:\\WATCOM";
|
||||
$ENV{"EDPATH"} = "$watcom\\EDDAT";
|
||||
$ENV{"WATC_INC"} = "$watcom\\h;$watcom\\h\win;$msvc_inc";
|
||||
$ENV{"WATC_LIB"} = $msvc_lib;
|
||||
$ENV{"WATCPATH"} = "$watcom\\BINNT;$watcom\\BINW;c:\\nstools\\bin";
|
||||
|
||||
$build_name = 'Win16 ' . ($build_depend?'Depend':'Clobber');
|
||||
$do_clobber = $clobber_str;
|
||||
$logname = "win16.log";
|
||||
|
||||
system "subst l: /d";
|
||||
system "subst r: /d";
|
||||
system "subst $src_16_drive /d";
|
||||
|
||||
system "subst $src_16_drive $start_dir";
|
||||
system "subst r: $src_16_drive\\ns\\netsite\\ldap\\libraries\\msdos\\winsock";
|
||||
system "subst l: $src_16_drive\\ns\\netsite";
|
||||
}
|
||||
|
||||
sub do_build {
|
||||
local ($pull, $do_clobber) = @_;
|
||||
|
||||
&start_build;
|
||||
|
||||
print "opening ${logname}\n";
|
||||
open( LOG, ">${logname}" ) || print "can't open $?\n";
|
||||
print LOG "current dir is :$cur_dir\n";
|
||||
|
||||
&print_env;
|
||||
$build_status = 0;
|
||||
if( $pull ){
|
||||
if ( $build_tag eq '' ){
|
||||
print LOG "cvs co -D\"$start_time_str\" mozilla/client.mak 2>&1 |\n";
|
||||
open( PULL, "cvs co -D\"$start_time_str\" mozilla/client.mak 2>&1 |") || print "couldn't execute cvs\n";;
|
||||
} else{
|
||||
print LOG "cvs co -r $build_tag mozilla/client.mak 2>&1 |\n";
|
||||
open( PULL, "cvs co -r $build_tag mozilla/client.mak 2>&1 |") || print "couldn't execute cvs\n";;
|
||||
}
|
||||
|
||||
# tee the output
|
||||
while( <PULL> ){
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close( PULL );
|
||||
|
||||
$build_status = $?;
|
||||
}
|
||||
|
||||
chdir("$moz_src/mozilla") || die "couldn't chdir to '$moz_src/mozilla'";
|
||||
|
||||
if( $do_clobber ne '' ){
|
||||
print LOG "nmake -f client.mak $do_clobber |\n";
|
||||
print "nmake -f client.mak $do_clobber |\n";
|
||||
open( PULL, "nmake -f client.mak $do_clobber 2>&1 |") || print "couldn't execute nmake\n";;
|
||||
|
||||
# tee the output
|
||||
while( <PULL> ){
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close( PULL );
|
||||
}
|
||||
|
||||
|
||||
if (!$pull) {
|
||||
$client_param = 'build_all';
|
||||
}
|
||||
else {
|
||||
$client_param = 'pull_and_build_all';
|
||||
}
|
||||
if (!$doawt11) {
|
||||
$client_param = 'build_dist';
|
||||
}
|
||||
|
||||
print LOG "nmake -f client.mak $client_param 2>&1 |\n";
|
||||
open( BUILD, "nmake -f client.mak $client_param 2>&1 |");
|
||||
|
||||
# tee the output
|
||||
while( <BUILD> ){
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close( BUILD );
|
||||
$build_status |= $?;
|
||||
|
||||
$build_status_str = ( $build_status ? 'busted' : 'success' );
|
||||
|
||||
print LOG "tinderbox: tree: $build_tree\n";
|
||||
print LOG "tinderbox: builddate: $start_time\n";
|
||||
print LOG "tinderbox: status: $build_status_str\n";
|
||||
print LOG "tinderbox: build: $build_name\n";
|
||||
print LOG "tinderbox: errorparser: windows\n";
|
||||
print LOG "tinderbox: buildfamily: windows\n";
|
||||
|
||||
close( LOG );
|
||||
chdir("$start_dir");
|
||||
system( "$nstools\\bin\\blat ${logname} -t tinderbox-daemon\@warp" );
|
||||
}
|
||||
|
||||
sub cvs_time {
|
||||
local( $ret_time );
|
||||
|
||||
($sec,$minute,$hour,$mday,$mon,$year) = localtime( $_[0] );
|
||||
$mon++; # month is 0 based.
|
||||
|
||||
sprintf("%02d/%02d/%02d %02d:%02d:00",
|
||||
$mon,$mday,$year,$hour,$minute );
|
||||
}
|
||||
|
||||
|
||||
sub start_build {
|
||||
open( LOG, ">>logfile" );
|
||||
print LOG "\n";
|
||||
print LOG "tinderbox: tree: $build_tree\n";
|
||||
print LOG "tinderbox: builddate: $start_time\n";
|
||||
print LOG "tinderbox: status: building\n";
|
||||
print LOG "tinderbox: build: $build_name\n";
|
||||
print LOG "tinderbox: errorparser: windows\n";
|
||||
print LOG "tinderbox: buildfamily: windows\n";
|
||||
print LOG "\n";
|
||||
close( LOG );
|
||||
system("$nstools\\bin\\blat logfile -t tinderbox-daemon\@warp" );
|
||||
}
|
||||
|
||||
sub parse_args {
|
||||
local($i);
|
||||
|
||||
if( @ARGV == 0 ){
|
||||
&usage;
|
||||
}
|
||||
$i = 0;
|
||||
while( $i < @ARGV ){
|
||||
if( $ARGV[$i] eq '--depend' ){
|
||||
$build_depend = 1;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--clobber' ){
|
||||
$build_depend = 0;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--continue' ){
|
||||
$build_continue = 1;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--noawt11' ){
|
||||
$noawt11 = 1;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--no32' ){
|
||||
$no32 = 1;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--no16' ){
|
||||
$no16 = 1;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '--test' ){
|
||||
$build_test = 1;
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '-tag' ){
|
||||
$i++;
|
||||
$build_tag = $ARGV[$i];
|
||||
if( $build_tag eq '' || $build_tag eq '-t'){
|
||||
&usage;
|
||||
}
|
||||
}
|
||||
elsif ( $ARGV[$i] eq '-t' ){
|
||||
$i++;
|
||||
$build_tree = $ARGV[$i];
|
||||
if( $build_tree eq '' ){
|
||||
&usage;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if( $build_tree eq '' ){
|
||||
&usage;
|
||||
}
|
||||
}
|
||||
|
||||
sub usage {
|
||||
die "usage: buildit.pl [--depend | --clobber] [--no16] [--continue] [--test] [-tag TAGNAME] -t TREENAME\n";
|
||||
}
|
||||
|
||||
sub setup_env {
|
||||
local($p);
|
||||
$ENV{"MOZ_DEBUG"} = '1';
|
||||
$ENV{"MOZ_GOLD"} = '1';
|
||||
$ENV{"NO_SECURITY"} = '1';
|
||||
$ENV{"MOZ_MEDIUM"} = '1';
|
||||
$ENV{"MOZ_CAFE"} = '1';
|
||||
$ENV{"NSPR20"} = '1';
|
||||
$ENV{"VERBOSE"} = '1';
|
||||
$nstools = $ENV{"MOZ_TOOLS"};
|
||||
if( $nstools eq '' ){
|
||||
die "error: environment variable MOZ_TOOLS not set\n";
|
||||
}
|
||||
$msdev = $ENV{"MOZ_MSDEV"} = 'c:\msdev';
|
||||
if( $msdev eq '' ){
|
||||
die "error: environment variable MOZ_MSDEV not set\n";
|
||||
}
|
||||
$msvc = $ENV{"MOZ_MSVC"} = 'c:\msvc';
|
||||
if( $msvc eq '' ){
|
||||
die "error: environment variable MOZ_VC not set\n";
|
||||
}
|
||||
if ( $build_tag ne '' ) {
|
||||
$ENV{"MOZ_BRANCH"} = $build_tag;
|
||||
}
|
||||
$moz_src = $ENV{"MOZ_SRC"} = $start_dir;
|
||||
$ENV{"MOZ_DATE"} = $start_time_str;
|
||||
$src_16_drive = 'y:';
|
||||
}
|
||||
|
||||
sub print_env {
|
||||
local( $k, $v);
|
||||
print LOG "\nEnvironment\n";
|
||||
print "\nEnvironment\n";
|
||||
for $k (sort keys %ENV){
|
||||
$v = $ENV{$k};
|
||||
print LOG " $k=$v\n";
|
||||
print " $k=$v\n";
|
||||
}
|
||||
print LOG "\n";
|
||||
print "\n";
|
||||
system 'set';
|
||||
}
|
||||
|
||||
sub strip_config {
|
||||
$save_compname=$ENV{"COMPUTERNAME"};
|
||||
$save_userdomain=$ENV{"USERDOMAIN"};
|
||||
$save_username=$ENV{"USERNAME"};
|
||||
$save_userprofile=$ENV{"USERPROFILE"};
|
||||
# most of these deletes have no effect.
|
||||
delete($ENV{"COMPUTERNAME"});
|
||||
delete($ENV{"USERDOMAIN"});
|
||||
delete($ENV{"USERNAME"});
|
||||
delete($ENV{"USERPROFILE"});
|
||||
# delete($ENV{"WATCOM"});
|
||||
|
||||
}
|
||||
|
||||
sub restore_config {
|
||||
$ENV{"COMPUTERNAME"}=$save_compname;
|
||||
$ENV{"USERDOMAIN"}=$save_userdomain;
|
||||
$ENV{"USERNAME"}=$save_username;
|
||||
$ENV{"MSDevDir"}=$save_userprofile;
|
||||
&print_env;
|
||||
}
|
||||
31
mozilla/webtools/tinderbox/faq.html
Executable file
31
mozilla/webtools/tinderbox/faq.html
Executable file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.0b2 (WinNT; I) [Netscape]">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H1>
|
||||
FAQ on Tinderbox </H1>
|
||||
<B><FONT SIZE=+2>Q. What is Tinderbox.</FONT></B>
|
||||
<BR><FONT SIZE=+2>A. Your very own automated build page. It shows you how builds
|
||||
are going on various platforms. fs</FONT>
|
||||
<BR><FONT SIZE=+2></FONT>
|
||||
<BR><B><FONT SIZE=+2>Q. I just checked in some code. How can I tell when
|
||||
I'm OK.</FONT></B>
|
||||
<BR><FONT SIZE=+2>A. You name will appear in the <I>guilty </I>column.
|
||||
When there are successful (<FONT COLOR="#00FF00">green</FONT>) builds in
|
||||
all the columns in a row <B>above</B> your name, you know you are ok.</FONT>
|
||||
<BR>
|
||||
<BR><B><FONT SIZE=+2>Q. The tree is broken, how do I find out what is busted
|
||||
(or who busted it).</FONT></B>
|
||||
<BR><FONT SIZE=+2>A. Clicking 'L' in the first red box (first build to break)
|
||||
above a green will show you a build log for the broken build. You
|
||||
can also click 'C' in this box and see what code was checked in.</FONT>
|
||||
<BR>
|
||||
<BR><B><FONT SIZE=+2>More Questions? Mail me <A HREF="mailto:ltabb@netscape.com">ltabb@netscape.com</A></FONT></B>
|
||||
<BR>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
217
mozilla/webtools/tinderbox/fixupimages.pl
Executable file
217
mozilla/webtools/tinderbox/fixupimages.pl
Executable file
@@ -0,0 +1,217 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use Socket;
|
||||
|
||||
require 'globals.pl';
|
||||
require 'imagelog.pl';
|
||||
|
||||
# Port an old-style imagelog thing to a newstyle one
|
||||
|
||||
open( IMAGELOG, "<$data_dir/imagelog.txt" ) || die "can't open file";
|
||||
open (OUT, ">$data_dir/newimagelog.txt") || die "can't open output file";
|
||||
select(OUT); $| = 1; select(STDOUT);
|
||||
|
||||
while( <IMAGELOG> ){
|
||||
chop;
|
||||
($url,$quote) = split(/\`/);
|
||||
print "$url\n";
|
||||
$size = &URLsize($url);
|
||||
$width = "";
|
||||
$height = "";
|
||||
if ($size =~ /WIDTH=([0-9]*)/) {
|
||||
$width = $1;
|
||||
}
|
||||
if ($size =~ /HEIGHT=([0-9]*)/) {
|
||||
$height = $1;
|
||||
}
|
||||
if ($width eq "" || $height eq "") {
|
||||
print "Couldn't get image size; skipping.\n";
|
||||
} else {
|
||||
print OUT "$url`$width`$height`$quote\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sub imgsize {
|
||||
local($file)= @_;
|
||||
|
||||
#first try to open the file
|
||||
if( !open(STREAM, "<$file") ){
|
||||
print "Can't open IMG $file";
|
||||
$size="";
|
||||
} else {
|
||||
if ($file =~ /.jpg/i || $file =~ /.jpeg/i) {
|
||||
$size = &jpegsize(STREAM);
|
||||
} elsif($file =~ /.gif/i) {
|
||||
$size = &gifsize(STREAM);
|
||||
} elsif($file =~ /.xbm/i) {
|
||||
$size = &xbmsize(STREAM);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
$_ = $size;
|
||||
if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
close(STREAM);
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine gets the size of the specified GIF
|
||||
###########################################################################
|
||||
sub gifsize {
|
||||
local($GIF) = @_;
|
||||
read($GIF, $type, 6);
|
||||
if(!($type =~ /GIF8[7,9]a/) ||
|
||||
!(read($GIF, $s, 4) == 4) ){
|
||||
print "Invalid or Corrupted GIF";
|
||||
$size="";
|
||||
} else {
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join ("", 'WIDTH=', $b<<8|$a, ' HEIGHT=', $d<<8|$c);
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
sub xbmsize {
|
||||
local($XBM) = @_;
|
||||
local($input)="";
|
||||
|
||||
$input .= <$XBM>;
|
||||
$input .= <$XBM>;
|
||||
$_ = $input;
|
||||
if( /#define\s*\S*\s*\d*\s*\n#define\s*\S*\s*\d*\s*\n/i ){
|
||||
($a,$b)=/#define\s*\S*\s*(\d*)\s*\n#define\s*\S*\s*(\d*)\s*\n/i;
|
||||
$size=join ("", 'WIDTH=', $a, ' HEIGHT=', $b );
|
||||
} else {
|
||||
print "Hmmm... Doesn't look like an XBM file";
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
# jpegsize : gets the width and height (in pixels) of a jpeg file
|
||||
# Andrew Tong, werdna@ugcs.caltech.edu February 14, 1995
|
||||
# modified slightly by alex@ed.ac.uk
|
||||
sub jpegsize {
|
||||
local($JPEG) = @_;
|
||||
local($done)=0;
|
||||
$size="";
|
||||
|
||||
read($JPEG, $c1, 1); read($JPEG, $c2, 1);
|
||||
if( !((ord($c1) == 0xFF) && (ord($c2) == 0xD8))){
|
||||
printf "This is not a JPEG! (Codes %02X %02X)\n", ord($c1), ord($c2);
|
||||
$done=1;
|
||||
}
|
||||
while (ord($ch) != 0xDA && !$done) {
|
||||
# Find next marker (JPEG markers begin with 0xFF)
|
||||
# This can hang the program!!
|
||||
while (ord($ch) != 0xFF) { read($JPEG, $ch, 1); }
|
||||
# JPEG markers can be padded with unlimited 0xFF's
|
||||
while (ord($ch) == 0xFF) { read($JPEG, $ch, 1); }
|
||||
# Now, $ch contains the value of the marker.
|
||||
$marker=ord($ch);
|
||||
|
||||
if (($marker >= 0xC0) && ($marker <= 0xCF) &&
|
||||
($marker != 0xC4) && ($marker != 0xCC)) { # it's a SOFn marker
|
||||
read ($JPEG, $junk, 3); read($JPEG, $s, 4);
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join("", 'HEIGHT=',$a<<8|$b,' WIDTH=',$c<<8|$d );
|
||||
$done=1;
|
||||
} else {
|
||||
# We **MUST** skip variables, since FF's within variable
|
||||
# names are NOT valid JPEG markers
|
||||
read ($JPEG, $s, 2);
|
||||
($c1, $c2) = unpack("C"x2,$s);
|
||||
$length = $c1<<8|$c2;
|
||||
if( ($length < 2) ){
|
||||
print "Erroneous JPEG marker length";
|
||||
$done=1;
|
||||
} else {
|
||||
read($JPEG, $junk, $length-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine grabs a gif from another server and gets its size
|
||||
###########################################################################
|
||||
|
||||
|
||||
sub URLsize {
|
||||
my ($fullurl) = @_;
|
||||
my($dummy, $dummy, $serverstring, $url) = split(/\//, $fullurl, 4);
|
||||
my($them,$port) = split(/:/, $serverstring);
|
||||
my $port = 80 unless $port;
|
||||
$them = 'localhost' unless $them;
|
||||
my $size="";
|
||||
|
||||
$_=$url;
|
||||
if( /gif/i || /jpeg/i || /jpg/i || /xbm/i ) {
|
||||
my ($remote, $iaddr, $paddr, $proto, $line);
|
||||
$remote = $them;
|
||||
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
|
||||
die "No port" unless $port;
|
||||
$iaddr = inet_aton($remote) || die "no host: $remote";
|
||||
$paddr = sockaddr_in($port, $iaddr);
|
||||
|
||||
$proto = getprotobyname('tcp');
|
||||
socket(S, PF_INET, SOCK_STREAM, $proto) || return "socket: $!";
|
||||
connect(S, $paddr) || return "connect: $!";
|
||||
select(S); $| = 1; select(STDOUT);
|
||||
|
||||
|
||||
|
||||
print S "GET /$url\n";
|
||||
if ($url =~ /.jpg/i || $url =~ /.jpeg/i) {
|
||||
$size = &jpegsize(S);
|
||||
} elsif($url =~ /.gif/i) {
|
||||
$size = &gifsize(S);
|
||||
} elsif($url =~ /.xbm/i) {
|
||||
$size = &xbmsize(S);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
$_ = $size;
|
||||
if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
} else {
|
||||
$size="";
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
sub dokill {
|
||||
kill 9,$child if $child;
|
||||
}
|
||||
556
mozilla/webtools/tinderbox/globals.pl
Executable file
556
mozilla/webtools/tinderbox/globals.pl
Executable file
@@ -0,0 +1,556 @@
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
#
|
||||
# Global variabls and functions for tinderbox
|
||||
#
|
||||
|
||||
#
|
||||
# Global variables
|
||||
#
|
||||
|
||||
$td1 = {};
|
||||
$td2 = {};
|
||||
|
||||
$build_list = []; # array of all build records
|
||||
$build_name_index = {};
|
||||
$ignore_builds = {};
|
||||
$build_name_names = [];
|
||||
$name_count = 0;
|
||||
|
||||
$build_time_index = {};
|
||||
$build_time_times = [];
|
||||
$time_count = 0;
|
||||
$mindate_time_count = 0; # time_count that corresponds to the mindate
|
||||
|
||||
$build_table = [];
|
||||
$who_list = [];
|
||||
$who_list2 = [];
|
||||
@note_array = ();
|
||||
|
||||
|
||||
#$body_tag = "<BODY TEXT=#000000 BGCOLOR=#8080C0 LINK=#FFFFFF VLINK=#800080 ALINK=#FFFF00>";
|
||||
#$body_tag = "<BODY TEXT=#000000 BGCOLOR=#FFFFC0 LINK=#0000FF VLINK=#800080 ALINK=#FF00FF>";
|
||||
if( $ENV{'USERNAME'} eq 'ltabb' ){
|
||||
$gzip = 'gzip';
|
||||
}
|
||||
else {
|
||||
$gzip = '/usr/local/bin/gzip';
|
||||
}
|
||||
|
||||
$data_dir='data';
|
||||
|
||||
$lock_count = 0;
|
||||
|
||||
1;
|
||||
|
||||
sub lock{
|
||||
#if( $lock_count == 0 ){
|
||||
# print "locking $tree/LOCKFILE.lck\n";
|
||||
# open( LOCKFILE_LOCK, ">$tree/LOCKFILE.lck" );
|
||||
# flock( LOCKFILE_LOCK, 2 );
|
||||
#}
|
||||
#$lock_count++;
|
||||
|
||||
}
|
||||
|
||||
sub unlock{
|
||||
#$lock_count--;
|
||||
#if( $lock_count == 0 ){
|
||||
# flock( LOCKFILE_LOCK, 8 );
|
||||
# close( LOCKFILE_LOCK );
|
||||
#}
|
||||
}
|
||||
|
||||
sub print_time {
|
||||
my ($t) = @_;
|
||||
my ($minute,$hour,$mday,$mon);
|
||||
(undef,$minute,$hour,$mday,$mon,undef) = localtime($t);
|
||||
sprintf("%02d/%02d %02d:%02d",$mon+1,$mday,$hour,$minute);
|
||||
}
|
||||
|
||||
sub url_encode {
|
||||
my ($s) = @_;
|
||||
|
||||
$s =~ s/\%/\%25/g;
|
||||
$s =~ s/\=/\%3d/g;
|
||||
$s =~ s/\?/\%3f/g;
|
||||
$s =~ s/ /\%20/g;
|
||||
$s =~ s/\n/\%0a/g;
|
||||
$s =~ s/\r//g;
|
||||
$s =~ s/\"/\%22/g;
|
||||
$s =~ s/\'/\%27/g;
|
||||
$s =~ s/\|/\%7c/g;
|
||||
$s =~ s/\&/\%26/g;
|
||||
return $s;
|
||||
}
|
||||
|
||||
sub url_decode {
|
||||
my ($value) = @_;
|
||||
$value =~ tr/+/ /;
|
||||
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
sub value_encode {
|
||||
my ($s) = @_;
|
||||
$s =~ s@&@&@g;
|
||||
$s =~ s@<@<@g;
|
||||
$s =~ s@>@>@g;
|
||||
$s =~ s@\"@"@g;
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
sub load_data {
|
||||
$tree2 = $form{'tree2'};
|
||||
if( $tree2 ne '' ){
|
||||
require "$tree2/treedata.pl";
|
||||
if( -r "$tree2/ignorebuilds.pl" ){
|
||||
require "$tree2/ignorebuilds.pl";
|
||||
}
|
||||
|
||||
$td2 = {};
|
||||
$td2->{name} = $tree2;
|
||||
$td2->{cvs_module} = $cvs_module;
|
||||
$td2->{cvs_branch} = $cvs_branch;
|
||||
$td2->{num} = 1;
|
||||
$td2->{ignore_builds} = $ignore_builds;
|
||||
if( $cvs_root eq '' ){
|
||||
$cvs_root = '/m/src';
|
||||
}
|
||||
$td2->{cvs_root} = $cvs_root;
|
||||
|
||||
$tree = $form{'tree'};
|
||||
require "$tree/treedata.pl";
|
||||
if( $cvs_root eq '' ){
|
||||
$cvs_root = '/m/src';
|
||||
}
|
||||
}
|
||||
|
||||
$tree = $form{'tree'};
|
||||
|
||||
return unless $tree;
|
||||
#die "the 'tree' parameter must be provided\n" unless $tree;
|
||||
|
||||
if ( -r "$tree/treedata.pl" ) {
|
||||
require "$tree/treedata.pl";
|
||||
}
|
||||
|
||||
$ignore_builds = {};
|
||||
if( -r "$tree/ignorebuilds.pl" ){
|
||||
require "$tree/ignorebuilds.pl";
|
||||
}
|
||||
|
||||
$td1 = {};
|
||||
$td1->{name} = $tree;
|
||||
$td1->{num} = 0;
|
||||
$td1->{cvs_module} = $cvs_module;
|
||||
$td1->{cvs_branch} = $cvs_branch;
|
||||
$td1->{ignore_builds} = $ignore_builds;
|
||||
if( $cvs_root eq '' ){
|
||||
$cvs_root = '/m/src';
|
||||
}
|
||||
$td1->{cvs_root} = $cvs_root;
|
||||
|
||||
&lock;
|
||||
&load_buildlog;
|
||||
&unlock;
|
||||
|
||||
&get_build_name_index;
|
||||
&get_build_time_index;
|
||||
|
||||
&load_who($who_list, $td1);
|
||||
if( $tree2 ne '' ){
|
||||
&load_who($who_list2, $td2);
|
||||
}
|
||||
|
||||
&make_build_table;
|
||||
}
|
||||
|
||||
sub load_buildlog {
|
||||
my $mailtime, $buildtime, $buildname, $errorparser;
|
||||
my $buildstatus, $logfile,$binaryname;
|
||||
my $buildrec, @treelist, $t;
|
||||
|
||||
if (not defined $maxdate) {
|
||||
$maxdate = time();
|
||||
}
|
||||
if (not defined $mindate) {
|
||||
$mindate = $maxdate - 24*60*60;
|
||||
}
|
||||
|
||||
if ($tree2 ne '') {
|
||||
@treelist = ($td1, $td2);
|
||||
}
|
||||
else {
|
||||
@treelist = ($td1);
|
||||
}
|
||||
|
||||
for $t (@treelist) {
|
||||
use Backwards;
|
||||
my ($bw) = Backwards->new("$t->{name}/build.dat") or die;
|
||||
|
||||
my $tooearly = 0;
|
||||
while( $_ = $bw->readline ) {
|
||||
chomp;
|
||||
($mailtime, $buildtime, $buildname,
|
||||
$errorparser, $buildstatus, $logfile, $binaryname) = split /\|/;
|
||||
|
||||
# Ignore stuff in the future.
|
||||
next if $buildtime > $maxdate;
|
||||
|
||||
# Ignore stuff in the past (but get a 2 hours of extra data)
|
||||
if ($buildtime < $mindate - 2*60*60) {
|
||||
# Occasionally, a build might show up with a bogus time. So,
|
||||
# we won't judge ourselves as having hit the end until we
|
||||
# hit a full 20 lines in a row that are too early.
|
||||
last if $tooearly++ > 20;
|
||||
|
||||
next;
|
||||
}
|
||||
$tooearly = 0;
|
||||
$buildrec = {
|
||||
mailtime => $mailtime,
|
||||
buildtime => $buildtime,
|
||||
buildname => ($tree2 ne '' ? $t->{name} . ' ' : '' ) . $buildname,
|
||||
errorparser => $errorparser,
|
||||
buildstatus => $buildstatus,
|
||||
logfile => $logfile,
|
||||
binaryname => $binaryname,
|
||||
td => $t
|
||||
};
|
||||
if ($form{noignore} or not $t->{ignore_builds}->{$buildname}) {
|
||||
push @{$build_list}, $buildrec;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub loadquickparseinfo {
|
||||
my ($tree, $build, $times) = (@_);
|
||||
|
||||
do "$tree/ignorebuilds.pl";
|
||||
|
||||
use Backwards;
|
||||
|
||||
my ($bw) = Backwards->new("$form{tree}/build.dat") or die;
|
||||
|
||||
my $latest_time = 0;
|
||||
my $tooearly = 0;
|
||||
while( $_ = $bw->readline ) {
|
||||
chop;
|
||||
my ($buildtime, $buildname, $buildstatus) = (split /\|/)[1,2,4];
|
||||
|
||||
if ($buildstatus =~ /^success|busted|testfailed$/) {
|
||||
|
||||
# Ignore stuff in the future.
|
||||
next if $buildtime > $maxdate;
|
||||
|
||||
$latest_time = $buildtime if $buildtime > $latest_time;
|
||||
|
||||
# Ignore stuff more than 12 hours old
|
||||
if ($buildtime < $latest_time - 12*60*60) {
|
||||
# Hack: A build may give a bogus time. To compensate, we will
|
||||
# not stop until we hit 20 consecutive lines that are too early.
|
||||
|
||||
last if $tooearly++ > 20;
|
||||
next;
|
||||
}
|
||||
$tooearly = 0;
|
||||
|
||||
next if exists $ignore_builds->{$buildname};
|
||||
next if exists $build->{$buildname}
|
||||
and $times->{$buildname} >= $buildtime;
|
||||
|
||||
$build->{$buildname} = $buildstatus;
|
||||
$times->{$buildname} = $buildtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub load_who {
|
||||
my ($who_list, $td) = @_;
|
||||
my $d, $w, $i, $bfound;
|
||||
|
||||
open(WHOLOG, "<$td->{name}/who.dat");
|
||||
while (<WHOLOG>) {
|
||||
$i = $time_count;
|
||||
chop;
|
||||
($d,$w) = split /\|/;
|
||||
$bfound = 0;
|
||||
while ($i > 0 and not $bfound) {
|
||||
if ($d <= $build_time_times->[$i]) {
|
||||
$who_list->[$i+1]->{$w} = 1;
|
||||
$bfound = 1;
|
||||
}
|
||||
else {
|
||||
$i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Ignore the last one
|
||||
#
|
||||
if ($time_count > 0) {
|
||||
$who_list->[$time_count] = {};
|
||||
}
|
||||
}
|
||||
|
||||
sub get_build_name_index {
|
||||
my $i,$br;
|
||||
|
||||
# Get all the unique build names.
|
||||
#
|
||||
foreach $br (@{$build_list}) {
|
||||
$build_name_index->{$br->{buildname}} = 1;
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
foreach $n (sort keys (%{$build_name_index})) {
|
||||
$build_name_names->[$i] = $n;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$name_count = @{$build_name_names}-1;
|
||||
|
||||
# Update the map so it points to the right index
|
||||
#
|
||||
for ($i=1; $i < $name_count+1; $i++) {
|
||||
$build_name_index->{$build_name_names->[$i]} = $i;
|
||||
}
|
||||
}
|
||||
|
||||
sub get_build_time_index {
|
||||
my $i,$br;
|
||||
|
||||
# Get all the unique build names.
|
||||
#
|
||||
foreach $br (@{$build_list}) {
|
||||
$build_time_index->{$br->{buildtime}} = 1;
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
foreach $n (sort {$b <=> $a} keys (%{$build_time_index})) {
|
||||
$build_time_times->[$i] = $n;
|
||||
$mindate_time_count = $i if $n >= $mindate;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$time_count = @{$build_time_times}-1;
|
||||
|
||||
# Update the map so it points to the right index
|
||||
#
|
||||
for ($i=1; $i < $time_count+1; $i++) {
|
||||
$build_time_index->{$build_time_times->[$i]} = $i;
|
||||
}
|
||||
|
||||
#for $i (@{$build_time_times}) {
|
||||
# print $i . "\n";
|
||||
#}
|
||||
|
||||
#while( ($k,$v) = each(%{$build_time_index})) {
|
||||
# print "$k=$v\n";
|
||||
#}
|
||||
}
|
||||
|
||||
sub make_build_table {
|
||||
my $i,$ti,$bi,$ti1,$br;
|
||||
|
||||
# Create the build table
|
||||
#
|
||||
for ($i=1; $i <= $time_count; $i++){
|
||||
$build_table->[$i] = [];
|
||||
}
|
||||
|
||||
# Populate the build table with build data
|
||||
#
|
||||
foreach $br (reverse @{$build_list}) {
|
||||
$ti = $build_time_index->{$br->{buildtime}};
|
||||
$bi = $build_name_index->{$br->{buildname}};
|
||||
$build_table->[$ti][$bi] = $br;
|
||||
}
|
||||
|
||||
&load_notes;
|
||||
|
||||
for ($bi = $name_count; $bi > 0; $bi--) {
|
||||
for ($ti = $time_count; $ti > 0; $ti--) {
|
||||
if (defined($br = $build_table->[$ti][$bi])
|
||||
and not defined($br->{rowspan})) {
|
||||
|
||||
# If the cell immediately after us is defined, then we
|
||||
# can have a previousbuildtime.
|
||||
if (defined($br1 = $build_table->[$ti+1][$bi])) {
|
||||
$br->{previousbuildtime} = $br1->{buildtime};
|
||||
}
|
||||
|
||||
$ti1 = $ti-1;
|
||||
while ($ti1 > 0 and not defined($build_table->[$ti1][$bi])) {
|
||||
$build_table->[$ti1][$bi] = -1;
|
||||
$ti1--;
|
||||
}
|
||||
$br->{rowspan} = $ti - $ti1;
|
||||
if ($br->{rowspan} != 1) {
|
||||
$build_table->[$ti1+1][$bi] = $br;
|
||||
$build_table->[$ti][$bi] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub load_notes {
|
||||
if ($tree2 ne '') {
|
||||
@treelist = ($td1, $td2);
|
||||
}
|
||||
else {
|
||||
@treelist = ($td1);
|
||||
}
|
||||
|
||||
foreach $t (@treelist) {
|
||||
open(NOTES,"<$t->{name}/notes.txt")
|
||||
or print "<h2>warning: Couldn't open $t->{name}/notes.txt </h2>\n";
|
||||
while (<NOTES>) {
|
||||
chop;
|
||||
($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split /\|/;
|
||||
$nbuildname = "$t->{name} $nbuildname" if $tree2 ne '';
|
||||
$ti = $build_time_index->{$nbuildtime};
|
||||
$bi = $build_name_index->{$nbuildname};
|
||||
#print "[ti = $ti][bi=$bi][buildname='$nbuildname' $_<br>";
|
||||
if ($ti != 0 and $bi != 0) {
|
||||
$build_table->[$ti][$bi]->{hasnote} = 1;
|
||||
if (not defined($build_table->[$ti][$bi]->{noteid})) {
|
||||
$build_table->[$ti][$bi]->{noteid} = (0+@note_array);
|
||||
}
|
||||
$noteid = $build_table->[$ti][$bi]->{noteid};
|
||||
$now_str = &print_time($nnow);
|
||||
$note = &url_decode($nenc_note);
|
||||
$note_array[$noteid] = "<pre>\n[<b><a href=mailto:$nwho>"
|
||||
."$nwho</a> - $now_str</b>]\n$note\n</pre>"
|
||||
.$note_array[$noteid];
|
||||
}
|
||||
}
|
||||
close(NOTES);
|
||||
}
|
||||
}
|
||||
|
||||
sub last_success_time {
|
||||
my ($row) = @_;
|
||||
|
||||
for (my $tt=1; $tt <= $time_count; $tt++) {
|
||||
my $br = $build_table->[$tt][$row];
|
||||
next unless defined $br;
|
||||
next unless $br->{buildstatus} eq 'success';
|
||||
return $build_time_times->[$tt + $br->{rowspan} ];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub last_status {
|
||||
my ($row) = @_;
|
||||
|
||||
for (my $tt=1; $tt <= $time_count; $tt++) {
|
||||
my $br = $build_table->[$tt][$row];
|
||||
next unless defined $br;
|
||||
next unless $br->{buildstatus} =~ /^(success|busted|testfailed)$/;
|
||||
return $br->{buildstatus};
|
||||
}
|
||||
return 'building';
|
||||
}
|
||||
|
||||
sub check_password {
|
||||
if ($form{password} eq '') {
|
||||
if (defined $cookie_jar{tinderbox_password}) {
|
||||
$form{password} = $cookie_jar{tinderbox_password};
|
||||
}
|
||||
}
|
||||
my $correct = '';
|
||||
if (open(REAL, '<data/passwd')) {
|
||||
$correct = <REAL>;
|
||||
close REAL;
|
||||
$correct =~ s/\s+$//; # Strip trailing whitespace.
|
||||
}
|
||||
$form{password} =~ s/\s+$//; # Strip trailing whitespace.
|
||||
if ($form{password} ne '') {
|
||||
open(TRAPDOOR, "../bonsai/data/trapdoor $form{'password'} |")
|
||||
or die "Can't run trapdoor func!";
|
||||
my $encoded = <TRAPDOOR>;
|
||||
close TRAPDOOR;
|
||||
$encoded =~ s/\s+$//; # Strip trailing whitespace.
|
||||
if ($encoded eq $correct) {
|
||||
if ($form{rememberpassword} ne '') {
|
||||
print "Set-Cookie: tinderbox_password=$form{'password'} ;"
|
||||
." path=/ ; expires = Sun, 1-Mar-2020 00:00:00 GMT\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
require 'header.pl';
|
||||
|
||||
print "Content-type: text/html\n";
|
||||
print "Set-Cookie: tinderbox_password= ; path=/ ; "
|
||||
." expires = Sun, 1-Mar-2020 00:00:00 GMT\n";
|
||||
print "\n";
|
||||
|
||||
EmitHtmlHeader("What's the magic word?",
|
||||
"You need to know the magic word to use this page.");
|
||||
|
||||
if ($form{password} ne '') {
|
||||
print "<B>Invalid password; try again.<BR></B>";
|
||||
}
|
||||
print q(
|
||||
<FORM method=post>
|
||||
<B>Password:</B>
|
||||
<INPUT NAME=password TYPE=password><BR>
|
||||
<INPUT NAME=rememberpassword TYPE=checkbox>
|
||||
If correct, remember password as a cookie<BR>
|
||||
);
|
||||
|
||||
while (my ($key,$value) = each %form) {
|
||||
next if $key eq "password" or $key eq "rememberpassword";
|
||||
|
||||
my $enc = value_encode($value);
|
||||
print "<INPUT TYPE=HIDDEN NAME=$key VALUE='$enc'>\n";
|
||||
}
|
||||
print "<INPUT TYPE=SUBMIT value=Submit></FORM>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub find_build_record {
|
||||
my ($tree, $logfile) = @_;
|
||||
|
||||
my $log_entry = `grep $logfile $tree/build.dat`;
|
||||
|
||||
chomp($log_entry);
|
||||
my ($mailtime, $buildtime, $buildname, $errorparser,
|
||||
$buildstatus, $logfile, $binaryname) = split /\|/, $log_entry;
|
||||
|
||||
$buildrec = {
|
||||
mailtime => $mailtime,
|
||||
buildtime => $buildtime,
|
||||
buildname => $buildname,
|
||||
errorparser => $errorparser,
|
||||
buildstatus => $buildstatus,
|
||||
logfile => $logfile,
|
||||
binaryname => $binaryname,
|
||||
td => undef
|
||||
};
|
||||
return $buildrec;
|
||||
}
|
||||
49
mozilla/webtools/tinderbox/handlemail.pl
Executable file
49
mozilla/webtools/tinderbox/handlemail.pl
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
# Figure out which directory tinderbox is in by looking at argv[0]. Unless
|
||||
# there is a command line argument; if there is, just use that.
|
||||
|
||||
$tinderboxdir = $0;
|
||||
$tinderboxdir =~ s:/[^/]*$::; # Remove last word, and slash before it.
|
||||
if ($tinderboxdir eq "") {
|
||||
$tinderboxdir = ".";
|
||||
}
|
||||
|
||||
if (@ARGV > 0) {
|
||||
$tinderboxdir = $ARGV[0];
|
||||
}
|
||||
|
||||
print "tinderbox = $tinderboxdir\n";
|
||||
|
||||
chdir $tinderboxdir || die "Couldn't chdir to $tinderboxdir";
|
||||
|
||||
|
||||
open(DF, ">data/tbx.$$") || die "could not open data/tbx.$$";
|
||||
while(<STDIN>){
|
||||
print DF $_;
|
||||
}
|
||||
close(DF);
|
||||
|
||||
$err = system("./processbuild.pl data/tbx.$$");
|
||||
|
||||
if( $err ) {
|
||||
die "processbuild.pl returned an error\n";
|
||||
}
|
||||
|
||||
43
mozilla/webtools/tinderbox/imagelog.pl
Executable file
43
mozilla/webtools/tinderbox/imagelog.pl
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
1;
|
||||
|
||||
sub add_imagelog {
|
||||
local($url,$quote,$width,$height) = @_;
|
||||
open( IMAGELOG, ">>$data_dir/imagelog.txt" ) || die "Oops; can't open imagelog.txt";
|
||||
print IMAGELOG "$url`$width`$height`$quote\n";
|
||||
close( IMAGELOG );
|
||||
}
|
||||
|
||||
sub get_image{
|
||||
local(@log,@ret,$i);
|
||||
|
||||
open( IMAGELOG, "<$data_dir/imagelog.txt" );
|
||||
@log = <IMAGELOG>;
|
||||
|
||||
# return a random line
|
||||
srand;
|
||||
@ret = split(/\`/,$log[rand @log]);
|
||||
|
||||
close( IMAGELOG );
|
||||
@ret;
|
||||
}
|
||||
|
||||
|
||||
12
mozilla/webtools/tinderbox/index.html
Executable file
12
mozilla/webtools/tinderbox/index.html
Executable file
@@ -0,0 +1,12 @@
|
||||
<TITLE>tinderbox</TITLE>
|
||||
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=showbuilds.cgi">
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"
|
||||
LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
|
||||
<CENTER>
|
||||
<TABLE BORDER=0 WIDTH="100%" HEIGHT="100%"><TR><TD ALIGN=CENTER VALIGN=CENTER>
|
||||
<FONT SIZE="+2">
|
||||
You're looking for
|
||||
<A HREF="showbuilds.cgi">showbuilds.cgi</A>.
|
||||
</FONT>
|
||||
</TD></TR></TABLE>
|
||||
</CENTER>
|
||||
241
mozilla/webtools/tinderbox/processbuild.pl
Executable file
241
mozilla/webtools/tinderbox/processbuild.pl
Executable file
@@ -0,0 +1,241 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
require 'globals.pl';
|
||||
require 'timelocal.pl';
|
||||
|
||||
umask 0;
|
||||
|
||||
#$logfile = '';
|
||||
|
||||
%MAIL_HEADER = ();
|
||||
$DONE = 0;
|
||||
$building = 0;
|
||||
$endsection = 0;
|
||||
|
||||
open( LOG, "<$ARGV[0]") || die "cant open $!";
|
||||
&parse_mail_header;
|
||||
while ($DONE == 0) {
|
||||
%tbx = ();
|
||||
&get_variables;
|
||||
|
||||
# run thru if EOF and we haven't hit our section end marker
|
||||
|
||||
if ( !$DONE || !$endsection) {
|
||||
&check_required_vars;
|
||||
$tree = $tbx{'tree'} if (!defined($tree));
|
||||
$logfile = "$builddate.$$.gz" if (!defined($logfile));
|
||||
$building++ if ($tbx{'status'} =~ m/building/);
|
||||
&lock;
|
||||
&write_build_data;
|
||||
&unlock;
|
||||
}
|
||||
}
|
||||
close(LOG);
|
||||
|
||||
&compress_log_file;
|
||||
&unlink_log_file;
|
||||
|
||||
system "./buildwho.pl $tree";
|
||||
|
||||
# Build static pages for Sidebar flash and tinderbox panels.
|
||||
$ENV{QUERY_STRING}="tree=$tree&static=1";
|
||||
system './showbuilds.cgi';
|
||||
|
||||
# end of main
|
||||
######################################################################
|
||||
|
||||
|
||||
# This routine will scan through log looking for 'tinderbox:' variables
|
||||
#
|
||||
sub get_variables{
|
||||
|
||||
#while( ($k,$v) = each( %MAIL_HEADER ) ){
|
||||
# print "$k='$v'\n";
|
||||
#}
|
||||
|
||||
&parse_log_variables;
|
||||
|
||||
#while( ($k,$v) = each( %tbx ) ){
|
||||
# print "$k='$v'\n";
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
sub parse_log_variables {
|
||||
my ($line, $stop);
|
||||
$stop = 0;
|
||||
while($stop == 0){
|
||||
$line = <LOG>;
|
||||
$DONE++, return if !defined($line);
|
||||
chomp($line);
|
||||
if( $line =~ /^tinderbox\:/ ){
|
||||
if( $line =~ /^tinderbox\:[ \t]*([^:]*)\:[ \t]*([^\n]*)/ ){
|
||||
$tbx{$1} = $2;
|
||||
} elsif ( $line =~ /^tinderbox: END/ ) {
|
||||
$stop++, $endsection++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub parse_mail_header {
|
||||
my $line;
|
||||
my $name = '';
|
||||
while($line = <LOG> ){
|
||||
chomp($line);
|
||||
|
||||
if( $line eq '' ){
|
||||
return;
|
||||
}
|
||||
|
||||
if( $line =~ /([^ :]*)\:[ \t]+([^\n]*)/ ){
|
||||
$name = $1;
|
||||
$name =~ tr/A-Z/a-z/;
|
||||
$MAIL_HEADER{$name} = $2;
|
||||
#print "$name $2\n";
|
||||
}
|
||||
elsif( $name ne '' ){
|
||||
$MAIL_HEADER{$name} .= $2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub check_required_vars {
|
||||
$err_string = '';
|
||||
if( $tbx{'tree'} eq ''){
|
||||
$err_string .= "Variable 'tinderbox:tree' not set.\n";
|
||||
}
|
||||
elsif( ! -r $tbx{'tree'} ){
|
||||
$err_string .= "Variable 'tinderbox:tree' not set to a valid tree.\n";
|
||||
}
|
||||
elsif(($MAIL_HEADER{'to'} =~ /external/i ||
|
||||
$MAIL_HEADER{'cc'} =~ /external/i) &&
|
||||
$tbx{'tree'} !~ /external/i) {
|
||||
$err_string .= "Data from an external source didn't specify an 'external' tree.";
|
||||
}
|
||||
if( $tbx{'build'} eq ''){
|
||||
$err_string .= "Variable 'tinderbox:build' not set.\n";
|
||||
}
|
||||
if( $tbx{'errorparser'} eq ''){
|
||||
$err_string .= "Variable 'tinderbox:errorparser' not set.\n";
|
||||
}
|
||||
|
||||
#
|
||||
# Grab the date in the form of mm/dd/yy hh:mm:ss
|
||||
#
|
||||
# Or a GMT unix date
|
||||
#
|
||||
if( $tbx{'builddate'} eq ''){
|
||||
$err_string .= "Variable 'tinderbox:builddate' not set.\n";
|
||||
}
|
||||
else {
|
||||
if( $tbx{'builddate'} =~
|
||||
/([0-9]*)\/([0-9]*)\/([0-9]*)[ \t]*([0-9]*)\:([0-9]*)\:([0-9]*)/ ){
|
||||
|
||||
$builddate = timelocal($6,$5,$4,$2,$1-1,$3);
|
||||
|
||||
}
|
||||
elsif( $tbx{'builddate'} > 7000000 ){
|
||||
$builddate = $tbx{'builddate'};
|
||||
}
|
||||
else {
|
||||
$err_string .= "Variable 'tinderbox:builddate' not of the form MM/DD/YY HH:MM:SS or unix date\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Build Status
|
||||
#
|
||||
if( $tbx{'status'} eq ''){
|
||||
$err_string .= "Variable 'tinderbox:status' not set.\n";
|
||||
}
|
||||
elsif( ! $tbx{'status'} =~ /success|busted|building|testfailed/ ){
|
||||
$err_string .= "Variable 'tinderbox:status' must be 'success', 'busted', 'testfailed', or 'building'\n";
|
||||
}
|
||||
|
||||
#
|
||||
# Report errors
|
||||
#
|
||||
if( $err_string ne '' ){
|
||||
die $err_string;
|
||||
}
|
||||
}
|
||||
|
||||
sub write_build_data {
|
||||
$t = time;
|
||||
open( BUILDDATA, ">>$tbx{'tree'}/build.dat" )|| die "can't open $! for writing";
|
||||
print BUILDDATA "$t|$builddate|$tbx{'build'}|$tbx{'errorparser'}|$tbx{'status'}|$logfile|$tbx{binaryname}\n";
|
||||
close( BUILDDATA );
|
||||
}
|
||||
|
||||
sub compress_log_file {
|
||||
local( $done, $line);
|
||||
|
||||
return if ( $building );
|
||||
|
||||
open( LOG2, "<$ARGV[0]") || die "cant open $!";
|
||||
|
||||
#
|
||||
# Skip past the the RFC822.HEADER
|
||||
#
|
||||
$done = 0;
|
||||
while( !$done && ($line = <LOG2>) ){
|
||||
chomp($line);
|
||||
$done = ($line eq '');
|
||||
}
|
||||
|
||||
open( ZIPLOG, "| $gzip -c > ${tree}/$logfile" ) || die "can't open $! for writing";
|
||||
$inBinary = 0;
|
||||
$hasBinary = ($tbx{'binaryname'} ne '');
|
||||
while( $line = <LOG2> ){
|
||||
if( !$inBinary ){
|
||||
print ZIPLOG $line;
|
||||
if( $hasBinary ){
|
||||
$inBinary = ($line =~ /^begin [0-7][0-7][0-7] /);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( $line =~ /^end\n/ ){
|
||||
$inBinary = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
close( ZIPLOG );
|
||||
close( LOG2 );
|
||||
|
||||
#
|
||||
# If a uuencoded binary is part of the build, unpack it.
|
||||
#
|
||||
if( $hasBinary ){
|
||||
$bin_dir = "$tbx{'tree'}/bin/$builddate/$tbx{'build'}";
|
||||
$bin_dir =~ s/ //g;
|
||||
|
||||
system("mkdir -m 0777 -p $bin_dir");
|
||||
|
||||
# LTNOTE: I'm not sure this is cross platform.
|
||||
system("/tools/ns/bin/uudecode --output-file=$bin_dir/$tbx{binaryname} < $ARGV[0]");
|
||||
}
|
||||
}
|
||||
|
||||
sub unlink_log_file {
|
||||
unlink( $ARGV[0] );
|
||||
}
|
||||
BIN
mozilla/webtools/tinderbox/reledanim.gif
Normal file
BIN
mozilla/webtools/tinderbox/reledanim.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
782
mozilla/webtools/tinderbox/showbuilds.cgi
Executable file
782
mozilla/webtools/tinderbox/showbuilds.cgi
Executable file
@@ -0,0 +1,782 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use lib '../bonsai';
|
||||
require 'globals.pl';
|
||||
require 'lloydcgi.pl';
|
||||
require 'imagelog.pl';
|
||||
require 'header.pl';
|
||||
$|=1;
|
||||
|
||||
# Hack this until I can figure out how to do get default root. -slamm
|
||||
$default_root = '/cvsroot';
|
||||
|
||||
# Show 12 hours by default
|
||||
#
|
||||
$nowdate = time;
|
||||
if (not defined($maxdate = $form{maxdate})) {
|
||||
$maxdate = $nowdate;
|
||||
}
|
||||
if ($form{showall}) {
|
||||
$mindate = 0;
|
||||
}
|
||||
else {
|
||||
$default_hours = 12;
|
||||
$hours = $default_hours;
|
||||
$hours = $form{hours} if $form{hours};
|
||||
$mindate = $maxdate - ($hours*60*60);
|
||||
}
|
||||
|
||||
%colormap = (
|
||||
success => '00ff00',
|
||||
busted => 'red',
|
||||
building => 'yellow',
|
||||
testfailed => 'orange'
|
||||
);
|
||||
|
||||
%images = (
|
||||
flames => '1afi003r.gif',
|
||||
star => 'star.gif'
|
||||
);
|
||||
|
||||
$tree = $form{tree};
|
||||
|
||||
if (exists $form{rebuildguilty} or exists $form{showall}) {
|
||||
system ("./buildwho.pl -days 7 $tree > /dev/null");
|
||||
undef $form{rebuildguilty};
|
||||
}
|
||||
&show_tree_selector, exit if $form{tree} eq '';
|
||||
&do_quickparse, exit if $form{quickparse};
|
||||
&do_express, exit if $form{express};
|
||||
&do_rdf, exit if $form{rdf};
|
||||
&do_static, exit if $form{static};
|
||||
&do_flash, exit if $form{flash};
|
||||
&do_panel, exit if $form{panel};
|
||||
&do_tinderbox, exit;
|
||||
|
||||
# end of main
|
||||
#=====================================================================
|
||||
|
||||
sub make_tree_list {
|
||||
my @result;
|
||||
while(<*>) {
|
||||
if( -d $_ && $_ ne 'data' && $_ ne 'CVS' && -f "$_/treedata.pl") {
|
||||
push @result, $_;
|
||||
}
|
||||
}
|
||||
return @result;
|
||||
}
|
||||
|
||||
sub show_tree_selector {
|
||||
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
EmitHtmlHeader("tinderbox");
|
||||
|
||||
print "<P><TABLE WIDTH=\"100%\">";
|
||||
print "<TR><TD ALIGN=CENTER>Select one of the following trees:</TD></TR>";
|
||||
print "<TR><TD ALIGN=CENTER>\n";
|
||||
print " <TABLE><TR><TD><UL>\n";
|
||||
|
||||
my @list = make_tree_list();
|
||||
|
||||
foreach (@list) {
|
||||
print "<LI><a href=showbuilds.cgi?tree=$_>$_</a>\n";
|
||||
}
|
||||
print "<//UL></TD></TR></TABLE></TD></TR></TABLE>";
|
||||
|
||||
print "<P><TABLE WIDTH=\"100%\">";
|
||||
print "<TR><TD ALIGN=CENTER><a href=admintree.cgi>";
|
||||
print "Administer</a> one of the following trees:</TD></TR>";
|
||||
print "<TR><TD ALIGN=CENTER>\n";
|
||||
print " <TABLE><TR><TD><UL>\n";
|
||||
|
||||
foreach (@list) {
|
||||
print "<LI><a href=admintree.cgi?tree=$_>$_</a>\n";
|
||||
}
|
||||
print "<//UL></TD></TR></TABLE></TD></TR></TABLE>";
|
||||
}
|
||||
|
||||
sub do_static {
|
||||
local *OUT;
|
||||
|
||||
$form{nocrap}=1;
|
||||
|
||||
my @pages = ( ['index.html', 'do_tinderbox'],
|
||||
['flash.rdf', 'do_flash'],
|
||||
['panel.html', 'do_panel'] );
|
||||
|
||||
$rel_path = '../';
|
||||
while (($key, $value) = each %images) {
|
||||
$images{$key} = "$rel_path$value";
|
||||
}
|
||||
|
||||
my $oldfh = select;
|
||||
|
||||
foreach $pair (@pages) {
|
||||
my ($page, $call) = @{$pair};
|
||||
my $outfile = "$form{tree}/$page";
|
||||
|
||||
open(OUT,">$outfile.$$");
|
||||
select OUT;
|
||||
|
||||
eval "$call";
|
||||
|
||||
close(OUT);
|
||||
system "mv $outfile.$$ $outfile";
|
||||
}
|
||||
select $oldfh;
|
||||
}
|
||||
|
||||
sub do_tinderbox {
|
||||
&load_data;
|
||||
&print_page_head;
|
||||
&print_table_header;
|
||||
&print_table_body;
|
||||
&print_table_footer;
|
||||
}
|
||||
|
||||
sub print_page_head {
|
||||
|
||||
print "Content-type: text/html",
|
||||
($nowdate eq $maxdate ? "\nRefresh: 900" : ''),
|
||||
"\n\n<HTML>\n" unless $form{static};
|
||||
|
||||
# Get the message of the day only on the first pageful
|
||||
do "$tree/mod.pl" if $nowdate eq $maxdate;
|
||||
|
||||
use POSIX qw(strftime);
|
||||
# Print time in format, "HH:MM timezone"
|
||||
my $now = strftime("%H:%M %Z", localtime);
|
||||
|
||||
EmitHtmlTitleAndHeader("tinderbox: $tree", "tinderbox",
|
||||
"tree: $tree ($now)");
|
||||
|
||||
&print_javascript;
|
||||
|
||||
print "$message_of_day\n";
|
||||
|
||||
# Quote and Lengend
|
||||
#
|
||||
unless ($form{nocrap}) {
|
||||
my ($imageurl,$imagewidth,$imageheight,$quote) = &get_image;
|
||||
print qq{
|
||||
<table width="100%" cellpadding=0 cellspacing=0>
|
||||
<tr>
|
||||
<td valign=bottom>
|
||||
<p><center><a href=addimage.cgi><img src="$rel_path$imageurl"
|
||||
width=$imagewidth height=$imageheight><br>
|
||||
$quote</a><br>
|
||||
</center>
|
||||
<p>
|
||||
<td align=right valign=bottom>
|
||||
<table cellspacing=0 cellpadding=1 border=0><tr><td align=center>
|
||||
<TT>L</TT></td><td>= Show Build Log
|
||||
</td></tr><tr><td align=center>
|
||||
<img src="$images{star}"></td><td>= Show Log comments
|
||||
</td></tr><tr><td colspan=2>
|
||||
<table cellspacing=1 cellpadding=1 border=1>
|
||||
<tr bgcolor="$colormap{success}"><td>Successful Build
|
||||
<tr bgcolor="$colormap{building}"><td>Build in Progress
|
||||
<tr bgcolor="$colormap{testfailed}"><td>Successful Build,
|
||||
but Tests Failed
|
||||
<tr bgcolor="$colormap{busted}"><td>Build Failed
|
||||
</table>
|
||||
</td></tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
};
|
||||
}
|
||||
if ($bonsai_tree) {
|
||||
print "The tree is currently <font size=+2>";
|
||||
print (&tree_open ? 'OPEN' : 'CLOSED');
|
||||
print "</font>\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub print_table_body {
|
||||
for (my $tt=1; $tt <= $time_count; $tt++) {
|
||||
last if $build_time_times->[$tt] < $mindate;
|
||||
print_table_row($tt);
|
||||
}
|
||||
}
|
||||
|
||||
sub print_table_row {
|
||||
my ($tt) = @_;
|
||||
|
||||
# Time column
|
||||
#
|
||||
my $query_link = '';
|
||||
my $end_query = '';
|
||||
my $pretty_time = &print_time($build_time_times->[$tt]);
|
||||
|
||||
($hour) = $pretty_time =~ /(\d\d):/;
|
||||
|
||||
if ($lasthour != $hour or &has_who_list($tt)) {
|
||||
$query_link = &query_ref($td1, $build_time_times->[$tt]);
|
||||
$end_query = '</a>';
|
||||
}
|
||||
if ($lasthour == $hour) {
|
||||
$pretty_time =~ s/^.* //;
|
||||
} else {
|
||||
$lasthour = $hour;
|
||||
}
|
||||
|
||||
my $hour_color = '';
|
||||
$hour_color = ' bgcolor=#e7e7e7' if $build_time_times->[$tt] % 7200 <= 3600;
|
||||
print "<tr align=center><td align=right$hour_color>",
|
||||
"$query_link\n$pretty_time$end_query</td>\n";
|
||||
|
||||
# Guilty
|
||||
#
|
||||
print '<td>';
|
||||
for $who (sort keys %{$who_list->[$tt]} ){
|
||||
$qr = &who_menu($td1, $build_time_times->[$tt],
|
||||
$build_time_times->[$tt-1],$who);
|
||||
$who =~ s/%.*$//;
|
||||
print " ${qr}$who</a>\n";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
# Build Status
|
||||
#
|
||||
for ($bn=1; $bn <= $name_count; $bn++) {
|
||||
if (not defined($br = $build_table->[$tt][$bn])) {
|
||||
# No build data for this time
|
||||
print "<td></td>\n";
|
||||
next;
|
||||
}
|
||||
next if $br == -1; # rowspan has covered this row
|
||||
|
||||
$hasnote = $br->{hasnote};
|
||||
$noteid = $hasnote ? $br->{noteid} : 0;
|
||||
$rowspan = $br->{rowspan};
|
||||
$rowspan = $mindate_time_count - $tt + 1
|
||||
if $tt + $rowspan - 1 > $mindate_time_count;
|
||||
$color = $colormap{$br->{buildstatus}};
|
||||
$status = $br->{buildstatus};
|
||||
print "<td rowspan=$rowspan bgcolor=${color}>\n";
|
||||
|
||||
$logfile = $br->{logfile};
|
||||
$errorparser = $br->{errorparser};
|
||||
$buildname = $br->{buildname};
|
||||
$buildtime = $br->{buildtime};
|
||||
$buildtree = $br->{td}->{name};
|
||||
|
||||
print "<tt>\n";
|
||||
|
||||
# Build Note
|
||||
#
|
||||
$buildname = &url_encode($buildname);
|
||||
my $logurl = "${rel_path}showlog.cgi?log=$buildtree/$logfile";
|
||||
|
||||
if ($hasnote) {
|
||||
print "<a href='$logurl' onclick=\"return ",
|
||||
"note(event,$noteid,'$logfile');\">",
|
||||
"<img src='$images{star}' border=0></a>\n";
|
||||
}
|
||||
|
||||
# Build Log
|
||||
#
|
||||
print "<A HREF='$logurl' onclick=\"return log(event,$bn,'$logfile');\">";
|
||||
print "L</a>";
|
||||
|
||||
# What Changed
|
||||
#
|
||||
if( $br->{previousbuildtime} ){
|
||||
my $previous_br = $build_table->[$tt+$rowspan][$bn];
|
||||
my $previous_rowspan = $previous_br->{rowspan};
|
||||
if (&has_who_list($tt+$rowspan,
|
||||
$tt+$rowspan+$previous_rowspan-1)) {
|
||||
print "\n", &query_ref($br->{td},
|
||||
$br->{previousbuildtime},
|
||||
$br->{buildtime});
|
||||
print "C</a>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($br->{binaryname} ne '') {
|
||||
$binfile = "$buildtree/bin/$buildtime/$br->{buildname}/"
|
||||
."$br->{binaryname}";
|
||||
$binfile =~ s/ //g;
|
||||
print " <a href=$rel_path$binfile>B</a>";
|
||||
}
|
||||
print "</tt>\n</td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
sub print_table_header {
|
||||
my $ii, $nspan;
|
||||
|
||||
print "<table border=1 bgcolor='#FFFFFF' cellspacing=1 cellpadding=1>\n";
|
||||
|
||||
print "<tr align=center>\n";
|
||||
print "<td rowspan=1><font size=-1>Click time to <br>see changes <br>",
|
||||
"since time</font></td>";
|
||||
print "<td><font size=-1>",
|
||||
"Click name to see what they did</font>";
|
||||
print "<br><font size=-2>",
|
||||
&open_showbuilds_href(rebuildguilty=>'1'),
|
||||
"Rebuild guilty list</a></td>";
|
||||
|
||||
for ($ii=1; $ii <= $name_count; $ii++) {
|
||||
|
||||
my $bn = $build_name_names->[$ii];
|
||||
$bn =~ s/Clobber/Clbr/g;
|
||||
$bn =~ s/Depend/Dep/g;
|
||||
$bn = "<font face='Helvetica,Arial' size=-1>$bn</font>";
|
||||
|
||||
my $last_status = &last_status($ii);
|
||||
if ($last_status eq 'busted') {
|
||||
if ($form{nocrap}) {
|
||||
print "<td rowspan=2 bgcolor=$colormap{busted}>$bn</td>";
|
||||
} else {
|
||||
print "<td rowspan=2 bgcolor=000000 background='$images{flames}'>";
|
||||
print "<font color=white>$bn</font></td>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "<td rowspan=2 bgcolor=$colormap{$last_status}>$bn</td>";
|
||||
}
|
||||
}
|
||||
print "</tr><tr>\n";
|
||||
print "<TH>Build Time</TH>\n";
|
||||
print "<TH>Guilty</th>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
sub print_table_footer {
|
||||
print "</table>\n";
|
||||
|
||||
my $nextdate = $maxdate - $hours*60*60;
|
||||
print &open_showbuilds_href(maxdate=>"$nextdate", nocrap=>'1')
|
||||
."Show next $hours hours</a>";
|
||||
|
||||
print "<p><a href='${rel_path}admintree.cgi?tree=$tree'>",
|
||||
"Administrate Tinderbox Trees</a><br>\n";
|
||||
}
|
||||
|
||||
sub open_showbuilds_url {
|
||||
my %args = (
|
||||
nocrap => "$form{nocrap}",
|
||||
@_
|
||||
);
|
||||
|
||||
my $url = "${rel_path}showbuilds.cgi?tree=$form{tree}";
|
||||
$url .= "&hours=$hours" if $hours ne $default_hours;
|
||||
while (my ($key, $value) = each %args) {
|
||||
$url .= "&$key=$value" if $value ne '';
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
sub open_showbuilds_href {
|
||||
return "<a href=".open_showbuilds_url(@_).">";
|
||||
}
|
||||
|
||||
sub query_ref {
|
||||
my ($td, $mindate, $maxdate, $who) = @_;
|
||||
my $output = '';
|
||||
|
||||
$output = "<a href=${rel_path}../bonsai/cvsquery.cgi";
|
||||
$output .= "?module=$td->{cvs_module}";
|
||||
$output .= "&branch=$td->{cvs_branch}" if $td->{cvs_branch} ne 'HEAD';
|
||||
$output .= "&cvsroot=$td->{cvs_root}" if $td->{cvs_root} ne $default_root;
|
||||
$output .= "&date=explicit&mindate=$mindate";
|
||||
$output .= "&maxdate=$maxdate" if $maxdate ne '';
|
||||
$output .= "&who=$who" if $who ne '';
|
||||
$output .= ">";
|
||||
}
|
||||
|
||||
sub query_ref2 {
|
||||
my ($td, $mindate, $maxdate, $who) = @_;
|
||||
return "${rel_path}../bonsai/cvsquery.cgi?module=$td->{cvs_module}"
|
||||
."&branch=$td->{cvs_branch}&cvsroot=$td->{cvs_root}"
|
||||
."&date=explicit&mindate=$mindate&maxdate=$maxdate&who="
|
||||
. url_encode($who);
|
||||
}
|
||||
|
||||
sub who_menu {
|
||||
my ($td, $mindate, $maxdate, $who) = @_;
|
||||
my $treeflag;
|
||||
|
||||
$qr = "${rel_path}../registry/who.cgi?email=". url_encode($who)
|
||||
. "&d=$td->{cvs_module}|$td->{cvs_branch}|$td->{cvs_root}|$mindate|$maxdate";
|
||||
|
||||
return "<a href='$qr' onclick=\"return who(event);\">";
|
||||
}
|
||||
|
||||
# Check to see if anyone checked in during time slot.
|
||||
# ex. has_who_list(1); # Check for checkins in most recent time slot.
|
||||
# ex. has_who_list(1,5); # Check range of times.
|
||||
sub has_who_list {
|
||||
my ($time1, $time2) = @_;
|
||||
|
||||
if (not defined(@who_check_list)) {
|
||||
# Build a static array of true/false values for each time slot.
|
||||
$who_check_list[$time_count] = 0;
|
||||
my ($t) = 1;
|
||||
for (; $t<=$time_count; $t++) {
|
||||
$who_check_list[$t] = 1 if each %{$who_list->[$t]};
|
||||
}
|
||||
}
|
||||
if ($time2) {
|
||||
for ($ii=$time1; $ii<=$time2; $ii++) {
|
||||
return 1 if $who_check_list[$ii]
|
||||
}
|
||||
return 0
|
||||
} else {
|
||||
return $who_check_list[$time1];
|
||||
}
|
||||
}
|
||||
|
||||
sub tree_open {
|
||||
my $done, $line, $a, $b;
|
||||
open(BID, "<../bonsai/data/$bonsai_tree/batchid")
|
||||
or print "can't open batchid<br>";
|
||||
($a,$b,$bid) = split / /, <BID>;
|
||||
close(BID);
|
||||
open(BATCH, "<../bonsai/data/$bonsai_tree/batch-${bid}")
|
||||
or print "can't open batch-${bid}<br>";;
|
||||
$done = 0;
|
||||
while (($line = <BATCH>) and not $done){
|
||||
if ($line =~ /^set treeopen/) {
|
||||
chop $line;
|
||||
($a,$b,$treestate) = split / /, $line ;
|
||||
$done = 1;
|
||||
}
|
||||
}
|
||||
close(BATCH);
|
||||
return $treestate;
|
||||
}
|
||||
|
||||
sub print_javascript {
|
||||
my $script;
|
||||
($script = <<"__ENDJS") =~ s/^ //gm;
|
||||
<script>
|
||||
if (parseInt(navigator.appVersion) < 4) {
|
||||
window.event = 0;
|
||||
}
|
||||
|
||||
function who(d) {
|
||||
var version = parseInt(navigator.appVersion);
|
||||
if (version < 4 || version >= 5) {
|
||||
return true;
|
||||
}
|
||||
var l = document.layers['popup'];
|
||||
l.src = d.target.href;
|
||||
l.top = d.target.y - 6;
|
||||
l.left = d.target.x - 6;
|
||||
if (l.left + l.clipWidth > window.width) {
|
||||
l.left = window.width - l.clipWidth;
|
||||
}
|
||||
l.visibility="show";
|
||||
return false;
|
||||
}
|
||||
function log_url(logfile) {
|
||||
return "showlog.cgi?log=" + buildtree + "/" + logfile;
|
||||
}
|
||||
function note(d,noteid,logfile) {
|
||||
var version = parseInt(navigator.appVersion);
|
||||
if (version < 4 || version >= 5) {
|
||||
document.location = log_url(logfile);
|
||||
return false;
|
||||
}
|
||||
var l = document.layers['popup'];
|
||||
l.document.write("<table border=1 cellspacing=1><tr><td>"
|
||||
+ notes[noteid] + "</tr></table>");
|
||||
l.document.close();
|
||||
|
||||
l.top = d.y-10;
|
||||
var zz = d.x;
|
||||
if (zz + l.clip.right > window.innerWidth) {
|
||||
zz = (window.innerWidth-30) - l.clip.right;
|
||||
if (zz < 0) { zz = 0; }
|
||||
}
|
||||
l.left = zz;
|
||||
l.visibility="show";
|
||||
return false;
|
||||
}
|
||||
function log(e,buildindex,logfile)
|
||||
{
|
||||
var logurl = log_url(logfile);
|
||||
var commenturl = "addnote.cgi?log=" + buildtree + "/" + logfile;
|
||||
var version = parseInt(navigator.appVersion);
|
||||
|
||||
if (version < 4 || version >= 5) {
|
||||
document.location = logurl;
|
||||
return false;
|
||||
}
|
||||
var q = document.layers["logpopup"];
|
||||
q.top = e.target.y - 6;
|
||||
|
||||
var yy = e.target.x;
|
||||
if ( yy + q.clip.right > window.innerWidth) {
|
||||
yy = (window.innerWidth-30) - q.clip.right;
|
||||
if (yy < 0) { yy = 0; }
|
||||
}
|
||||
q.left = yy;
|
||||
q.visibility="show";
|
||||
q.document.write("<TABLE BORDER=1><TR><TD><B>"
|
||||
+ builds[buildindex] + "</B><BR>"
|
||||
+ "<A HREF=$rel_path" + logurl + ">View Brief Log</A><BR>"
|
||||
+ "<A HREF=$rel_path" + logurl + "&fulltext=1"+">View Full Log</A><BR>"
|
||||
+ "<A HREF=$rel_path" + commenturl + ">Add a Comment</A><BR>"
|
||||
+ "</TD></TR></TABLE>");
|
||||
q.document.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
notes = new Array();
|
||||
builds = new Array();
|
||||
|
||||
__ENDJS
|
||||
print $script;
|
||||
|
||||
$ii = 0;
|
||||
while ($ii < @note_array) {
|
||||
$ss = $note_array[$ii];
|
||||
while ($ii < @note_array && $note_array[$ii] eq $ss) {
|
||||
print "notes[$ii] = ";
|
||||
$ii++;
|
||||
}
|
||||
$ss =~ s/\\/\\\\/g;
|
||||
$ss =~ s/\"/\\\"/g;
|
||||
$ss =~ s/\n/\\n/g;
|
||||
print "\"$ss\";\n";
|
||||
}
|
||||
for ($ii=1; $ii <= $name_count; $ii++) {
|
||||
if (defined($br = $build_table->[1][$ii]) and $br != -1) {
|
||||
my $bn = $build_name_names->[$ii];
|
||||
print "builds[$ii]='$bn';\n";
|
||||
}
|
||||
}
|
||||
print "buildtree = '$form{tree}';\n";
|
||||
|
||||
($script = <<'__ENDJS') =~ s/^ //gm;
|
||||
</script>
|
||||
|
||||
<layer name="popup" onMouseOut="this.visibility='hide';"
|
||||
left=0 top=0 bgcolor="#ffffff" visibility="hide">
|
||||
</layer>
|
||||
|
||||
<layer name="logpopup" onMouseOut="this.visibility='hide';"
|
||||
left=0 top=0 bgcolor="#ffffff" visibility="hide">
|
||||
</layer>
|
||||
__ENDJS
|
||||
print $script;
|
||||
}
|
||||
|
||||
sub do_express {
|
||||
print "Content-type: text/html\nRefresh: 900\n\n<HTML>\n";
|
||||
|
||||
my %build, %times;
|
||||
loadquickparseinfo($form{tree}, \%build, \%times);
|
||||
|
||||
my @keys = sort keys %build;
|
||||
my $keycount = @keys;
|
||||
my $tm = &print_time(time);
|
||||
print "<table border=1 cellpadding=1 cellspacing=1><tr>";
|
||||
print "<th align=left colspan=$keycount>";
|
||||
print &open_showbuilds_href."$tree as of $tm</a></tr><tr>\n";
|
||||
foreach my $buildname (@keys) {
|
||||
print "<td bgcolor='$colormap{$build{$buildname}}'>$buildname</td>";
|
||||
}
|
||||
print "</tr></table>\n";
|
||||
}
|
||||
|
||||
# This is essentially do_express but it outputs a different format
|
||||
sub do_panel {
|
||||
print "Content-type: text/html\n\n<HTML>\n" unless $form{static};
|
||||
|
||||
my %build, %times;
|
||||
loadquickparseinfo($form{tree}, \%build, \%times);
|
||||
|
||||
print q(
|
||||
<head>
|
||||
<META HTTP-EQUIV="Refresh" CONTENT="300">
|
||||
<style>
|
||||
body, td {
|
||||
font-family: Verdana, Sans-Serif;
|
||||
font-size: 8pt;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body BGCOLOR="#FFFFFF" TEXT="#000000"
|
||||
LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
|
||||
);
|
||||
# Hack the panel link for now.
|
||||
print "<a target='_content' href='http://tinderbox.mozilla.org/seamonkey/'>$tree";
|
||||
|
||||
$bonsai_tree = '';
|
||||
require "$tree/treedata.pl";
|
||||
if ($bonsai_tree ne '') {
|
||||
print " is ", tree_open() ? "OPEN" : "CLOSED";
|
||||
}
|
||||
# Add the current time
|
||||
my ($minute,$hour,$mday,$mon) = (localtime)[1..4];
|
||||
my $tm = sprintf("%d/%d %d:%02d",$mon+1,$mday,$hour,$minute);
|
||||
print " as of $tm</a><br>";
|
||||
|
||||
print "<table border=0 cellpadding=1 cellspacing=1>";
|
||||
while (my ($name, $status) = each %build) {
|
||||
print "<tr><td bgcolor='$colormap{$status}'>$name</td></tr>";
|
||||
}
|
||||
print "</table></body>";
|
||||
}
|
||||
|
||||
sub do_flash {
|
||||
print "Content-type: text/rdf\n\n" unless $form{static};
|
||||
|
||||
my %build, %times;
|
||||
loadquickparseinfo($form{tree}, \%build, \%times);
|
||||
|
||||
my ($mac,$unix,$win) = (0,0,0);
|
||||
|
||||
while (my ($name, $status) = each %build) {
|
||||
next if $status eq 'success';
|
||||
$mac = 1, next if $name =~ /Mac/;
|
||||
$win = 1, next if $name =~ /Win/;
|
||||
$unix = 1;
|
||||
}
|
||||
|
||||
print q{
|
||||
<RDF:RDF xmlns:RDF='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
|
||||
xmlns:NC='http://home.netscape.com/NC-rdf#'>
|
||||
<RDF:Description about='NC:FlashRoot'>
|
||||
};
|
||||
|
||||
my $busted = $mac + $unix + $win;
|
||||
if ($busted) {
|
||||
|
||||
# Construct a legible sentence; e.g., "Mac, Unix, and Windows
|
||||
# are busted", "Windows is busted", etc. This is hideous. If
|
||||
# you can think of something better, please fix it.
|
||||
|
||||
my $text;
|
||||
if ($mac) {
|
||||
$text .= 'Mac' . ($busted > 2 ? ', ' : ($busted > 1 ? ' and ' : ''));
|
||||
}
|
||||
if ($unix) {
|
||||
$text .= 'Unix' . ($busted > 2 ? ', and ' : ($win ? ' and ' : ''));
|
||||
}
|
||||
if ($win) {
|
||||
$text .= 'Windows';
|
||||
}
|
||||
$text .= ($busted > 1 ? ' are ' : ' is ') . 'busted';
|
||||
|
||||
# The Flash spec says we need to give ctime.
|
||||
use POSIX;
|
||||
my $tm = POSIX::ctime(time());
|
||||
$tm =~ s/^...\s//; # Strip day of week
|
||||
$tm =~ s/:\d\d\s/ /; # Strip seconds
|
||||
chop $tm;
|
||||
|
||||
print qq{
|
||||
<NC:child>
|
||||
<RDF:Description ID='flash'>
|
||||
<NC:type resource='http://www.mozilla.org/RDF#TinderboxFlash' />
|
||||
<NC:source>$tree</NC:source>
|
||||
<NC:description>$text</NC:description>
|
||||
<NC:timestamp>$tm</NC:timestamp>
|
||||
</RDF:Description>
|
||||
</NC:child>
|
||||
};
|
||||
}
|
||||
print q{
|
||||
</RDF:Description>
|
||||
</RDF:RDF>
|
||||
};
|
||||
}
|
||||
|
||||
sub do_quickparse {
|
||||
print "Content-type: text/plain\n\n";
|
||||
|
||||
my @treelist = split /,/, $tree;
|
||||
foreach my $t (@treelist) {
|
||||
$bonsai_tree = "";
|
||||
require "$t/treedata.pl";
|
||||
if ($bonsai_tree ne "") {
|
||||
my $state = tree_open() ? "Open" : "Close";
|
||||
print "State|$t|$bonsai_tree|$state\n";
|
||||
}
|
||||
my %build, %times;
|
||||
loadquickparseinfo($t, \%build, \%times);
|
||||
|
||||
foreach my $buildname (sort keys %build) {
|
||||
print "Build|$t|$buildname|$build{$buildname}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub do_rdf {
|
||||
print "Content-type: text/plain\n\n";
|
||||
|
||||
my $mainurl = "http://$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}?tree=$tree";
|
||||
my $dirurl = $mainurl;
|
||||
|
||||
$dirurl =~ s@/[^/]*$@@;
|
||||
|
||||
my %build, %times;
|
||||
loadquickparseinfo($tree, \%build, \%times);
|
||||
|
||||
my $image = "channelok.gif";
|
||||
my $imagetitle = "OK";
|
||||
foreach my $buildname (sort keys %build) {
|
||||
if ($build{$buildname} eq 'busted') {
|
||||
$image = "channelflames.gif";
|
||||
$imagetitle = "Bad";
|
||||
last;
|
||||
}
|
||||
}
|
||||
print qq{<?xml version="1.0"?>
|
||||
<rdf:RDF
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://my.netscape.com/rdf/simple/0.9/">
|
||||
<channel>
|
||||
<title>Tinderbox - $tree</title>
|
||||
<description>Build bustages for $tree</description>
|
||||
<link>$mainurl</link>
|
||||
</channel>
|
||||
<image>
|
||||
<title>$imagetitle</title>
|
||||
<url>$dirurl/$image</url>
|
||||
<link>$mainurl</link>
|
||||
</image>
|
||||
};
|
||||
|
||||
$bonsai_tree = '';
|
||||
require "$tree/treedata.pl";
|
||||
if ($bonsai_tree ne '') {
|
||||
my $state = tree_open() ? "OPEN" : "CLOSED";
|
||||
print "<item><title>The tree is currently $state</title>",
|
||||
"<link>$mainurl</link></item>\n";
|
||||
}
|
||||
|
||||
foreach my $buildname (sort keys %build) {
|
||||
if ($build{$buildname} eq 'busted') {
|
||||
print "<item><title>$buildname is in flames</title>",
|
||||
"<link>$mainurl</link></item>\n";
|
||||
}
|
||||
}
|
||||
print "</rdf:RDF>\n";
|
||||
}
|
||||
|
||||
136
mozilla/webtools/tinderbox/showimages.cgi
Executable file
136
mozilla/webtools/tinderbox/showimages.cgi
Executable file
@@ -0,0 +1,136 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
|
||||
$| = 1;
|
||||
|
||||
use lib "../bonsai";
|
||||
|
||||
require 'globals.pl';
|
||||
require 'imagelog.pl';
|
||||
require 'lloydcgi.pl';
|
||||
require 'header.pl';
|
||||
|
||||
check_password();
|
||||
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
@url = ();
|
||||
@quote = ();
|
||||
@width = ();
|
||||
@height = ();
|
||||
$i = 0;
|
||||
|
||||
EmitHtmlHeader("tinderbox: all images");
|
||||
|
||||
print '<UL>
|
||||
<P>These are all of the images currently in
|
||||
<A HREF=http://www.mozilla.org/tinderbox.html>Tinderbox</A>.
|
||||
<P>Please don\'t give out this URL: this is only here for our debugging
|
||||
needs, and isn\'t linked to by the rest of Tinderbox: because looking at
|
||||
all the images at once would be be cheating! you\'re supposed to let them
|
||||
surprise you over time. What, do you read ahead in your desktop calendar,
|
||||
too? Where\'s your sense of mystery and anticipation?
|
||||
|
||||
<P>
|
||||
</UL>
|
||||
';
|
||||
|
||||
|
||||
|
||||
|
||||
if ($form{'url'} ne "") {
|
||||
$oldname = "$data_dir/imagelog.txt";
|
||||
open (OLD, "<$oldname") || die "Oops; can't open imagelog.txt";
|
||||
$newname = "$oldname-$$";
|
||||
open (NEW, ">$newname") || die "Can't open $newname";
|
||||
$foundit = 0;
|
||||
while (<OLD>) {
|
||||
chop;
|
||||
($url, $width, $height, $quote) = split(/\`/);
|
||||
if ($url eq $form{'url'} && $quote eq $form{'origquote'}) {
|
||||
$foundit = 1;
|
||||
if ($form{'nukeit'} ne "") {
|
||||
next;
|
||||
}
|
||||
$quote = $form{'quote'};
|
||||
}
|
||||
print NEW "$url`$width`$height`$quote\n";
|
||||
}
|
||||
close OLD;
|
||||
close NEW;
|
||||
if (!$foundit) {
|
||||
print "<font color=red>Hey, couldn't find it!</font> Did someone\n";
|
||||
print "else already edit it?<P>\n";
|
||||
unlink $newname;
|
||||
} else {
|
||||
print "Change made.<P>";
|
||||
rename ($newname, $oldname) || die "Couldn't rename $newname to $oldname";
|
||||
}
|
||||
$form{'doedit'} = "1";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$doedit = ($form{'doedit'} ne "");
|
||||
|
||||
if (!$doedit) {
|
||||
print "
|
||||
<form method=post>
|
||||
<input type=hidden name=password value=\"$form{'password'}\">
|
||||
<input type=hidden name=doedit value=1>
|
||||
<input type=submit value='Let me edit text or remove pictures.'>
|
||||
</form><P>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
open( IMAGELOG, "<$data_dir/imagelog.txt" ) || die "can't open file";
|
||||
while( <IMAGELOG> ){
|
||||
chop;
|
||||
($url[$i],$width[$i],$height[$i],$quote[$i]) = split(/\`/);
|
||||
$i++;
|
||||
}
|
||||
close( IMAGELOG );
|
||||
|
||||
$i--;
|
||||
print "<center>";
|
||||
while( $i >= 0 ){
|
||||
$qurl = value_encode($url[$i]);
|
||||
$qquote = value_encode($quote[$i]);
|
||||
print "
|
||||
<img border=2 src='$url[$i]' width='$width[$i]' height='$height[$i]'><br>
|
||||
<i>$quote[$i]</i>";
|
||||
if ($doedit) {
|
||||
print "
|
||||
<form method=post>
|
||||
<input type=submit name=nukeit value='Delete this image'><br>
|
||||
<input name=quote size=60 value=\"$qquote\"><br>
|
||||
<input type=submit name=edit value='Change text'><hr>
|
||||
<input type=hidden name=url value=\"$qurl\">
|
||||
<input type=hidden name=origquote value=\"$qquote\">
|
||||
<input type=hidden name=password value=\"$form{'password'}\">
|
||||
</form>";
|
||||
}
|
||||
print "<br><br>\n";
|
||||
$i--;
|
||||
}
|
||||
|
||||
|
||||
375
mozilla/webtools/tinderbox/showlog.cgi
Executable file
375
mozilla/webtools/tinderbox/showlog.cgi
Executable file
@@ -0,0 +1,375 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use lib '../bonsai';
|
||||
|
||||
require 'globals.pl';
|
||||
require 'lloydcgi.pl';
|
||||
require 'header.pl';
|
||||
|
||||
#############################################################
|
||||
# Global variables
|
||||
|
||||
$LINES_AFTER_ERROR = 5;
|
||||
$LINES_BEFORE_ERROR = 30;
|
||||
|
||||
# These variables are set by the error parser functions:
|
||||
# has_error(), has_warning(), and has_errorline().
|
||||
$error_file = '';
|
||||
$error_file_ref = '';
|
||||
$error_line = 0;
|
||||
$error_guess = 0;
|
||||
|
||||
$next_err = 0;
|
||||
@log_errors = ();
|
||||
$log_line = 0;
|
||||
|
||||
#############################################################
|
||||
# CGI inputs
|
||||
|
||||
if (defined($args = $form{log}) or defined($args = $form{exerpt})) {
|
||||
|
||||
($full_logfile, $linenum) = split /:/, $args;
|
||||
($tree, $logfile) = split /\//, $full_logfile;
|
||||
|
||||
my $br = find_build_record($tree, $logfile);
|
||||
$errorparser = $br->{errorparser};
|
||||
$buildname = $br->{buildname};
|
||||
$buildtime = $br->{buildtime};
|
||||
|
||||
$numlines = 50;
|
||||
$numlines = $form{numlines} if exists $form{numlines};
|
||||
} else {
|
||||
$tree = $form{tree};
|
||||
$errorparser = $form{errorparser};
|
||||
$logfile = $form{logfile};
|
||||
$buildname = $form{buildname};
|
||||
$buildtime = $form{buildtime};
|
||||
}
|
||||
$fulltext = $form{fulltext};
|
||||
|
||||
$enc_buildname = &url_encode($buildname);
|
||||
|
||||
die "the \"tree\" parameter must be provided\n" unless $tree;
|
||||
require "$tree/treedata.pl";
|
||||
|
||||
$time_str = print_time( $buildtime );
|
||||
|
||||
$|=1;
|
||||
|
||||
if ($linenum) {
|
||||
|
||||
&print_fragment;
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
&print_header;
|
||||
&print_notes;
|
||||
|
||||
# Dynamically load the error parser
|
||||
#
|
||||
die "the \"errorparser\" parameter must be provided\n" unless $errorparser;
|
||||
require "ep_${errorparser}.pl";
|
||||
|
||||
if ($fulltext)
|
||||
{
|
||||
&print_summary;
|
||||
&print_log;
|
||||
}
|
||||
else
|
||||
{
|
||||
$brief_filename = $logfile;
|
||||
$brief_filename =~ s/.gz$/.brief.html/;
|
||||
if (-T "$tree/$brief_filename" and -M _ > -M $tree/$logfile)
|
||||
{
|
||||
open (BRIEFFILE, "<$tree/$brief_filename");
|
||||
print while (<BRIEFFILE>)
|
||||
}
|
||||
else
|
||||
{
|
||||
open (BRIEFFILE, ">$tree/$brief_filename");
|
||||
|
||||
&print_summary;
|
||||
&print_log;
|
||||
}
|
||||
}
|
||||
|
||||
# end of main
|
||||
############################################################
|
||||
|
||||
sub print_fragment {
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
print "<META HTTP-EQUIV=\"EXPIRES\" CONTENT=\"1\">\n";
|
||||
|
||||
my $heading = "Build Log (Fragment)";
|
||||
my $subheading = "$buildname on $time_str";
|
||||
my $title = "$heading - $subheading";
|
||||
|
||||
EmitHtmlTitleAndHeader($title, $heading, $subheading);
|
||||
|
||||
print "<a href='showlog.cgi?tree=$tree&errorparser=$errorparser&logfile=$logfile&buildtime=$buildtime&buildname=$enc_buildname&fulltext=1'>Show Full Build Log</a>";
|
||||
|
||||
open(BUILD_IN, "$gzip -d -c $tree/$logfile|");
|
||||
|
||||
my $first_line = $linenum - ($numlines/2);
|
||||
my $last_line = $linenum + ($numlines/2);
|
||||
|
||||
print "<pre><b>.<br>.<br>.<br></b>";
|
||||
while(<BUILD_IN>) {
|
||||
next if $. < $first_line;
|
||||
last if $. > $last_line;
|
||||
print "<b><font color='red'>" if $. == $linenum;
|
||||
print;
|
||||
print "</font></b>" if $. == $linenum;
|
||||
}
|
||||
print "<b>.<br>.<br>.<br></b></pre>";
|
||||
|
||||
}
|
||||
|
||||
sub print_header {
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
if( $fulltext ){
|
||||
$s = 'Show <b>Brief</b> Log';
|
||||
$s1 = '';
|
||||
$s2 = 'Full';
|
||||
}
|
||||
else {
|
||||
$s = 'Show <b>Full</b> Log';
|
||||
$s1 = 1;
|
||||
$s2 = 'Brief';
|
||||
}
|
||||
|
||||
print "<META HTTP-EQUIV=\"EXPIRES\" CONTENT=\"1\">\n";
|
||||
|
||||
my $heading = "Build Log ($s2)";
|
||||
my $subheading = "$buildname on $time_str";
|
||||
my $title = "$heading - $subheading";
|
||||
|
||||
EmitHtmlTitleAndHeader($title, $heading, $subheading);
|
||||
|
||||
print "
|
||||
<font size=+1>
|
||||
<dt><a href='showlog.cgi?tree=$tree&errorparser=$errorparser&logfile=$logfile&buildtime=$buildtime&buildname=$enc_buildname&fulltext=$s1'>$s</a>
|
||||
<dt><a href=\"showbuilds.cgi?tree=$tree\">Return to the Build Page</a>
|
||||
<dt><a href=\"addnote.cgi?tree=$tree\&buildname=$enc_buildname\&buildtime=$buildtime\&logfile=$logfile\&errorparser=$errorparser\">
|
||||
Add a Comment to the Log</a>
|
||||
</font>
|
||||
";
|
||||
}
|
||||
|
||||
sub print_notes {
|
||||
#
|
||||
# Print notes
|
||||
#
|
||||
$found_note = 0;
|
||||
open(NOTES,"<$tree/notes.txt")
|
||||
or print "<h2>warning: Couldn't open $tree/notes.txt </h2>\n";
|
||||
print "$buildtime, $buildname<br>\n";
|
||||
while(<NOTES>){
|
||||
chop;
|
||||
($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split(/\|/);
|
||||
#print "$_<br>\n";
|
||||
if( $nbuildtime == $buildtime && $nbuildname eq $buildname ){
|
||||
if( !$found_note ){
|
||||
print "<H2>Build Comments</H2>\n";
|
||||
$found_note = 1;
|
||||
}
|
||||
$now_str = &print_time($nnow);
|
||||
$note = &url_decode($nenc_note);
|
||||
print "<pre>\n[<b><a href=mailto:$nwho>$nwho</a> - $now_str</b>]\n$note\n</pre>";
|
||||
}
|
||||
}
|
||||
close(NOTES);
|
||||
}
|
||||
|
||||
sub print_summary {
|
||||
#
|
||||
# Print the summary first
|
||||
#
|
||||
logprint('<H2>Build Error Summary</H2><PRE>');
|
||||
|
||||
$log_line = 0;
|
||||
open( BUILD_IN, "$gzip -d -c $tree/$logfile|" );
|
||||
while( $line = <BUILD_IN> ){
|
||||
&output_summary_line( $line );
|
||||
}
|
||||
close( BUILD_IN );
|
||||
push @log_errors, 9999999;
|
||||
|
||||
logprint('</PRE>');
|
||||
}
|
||||
|
||||
sub print_log_section {
|
||||
my ($tree, $logfile, $line_of_interest, $num_lines) = shift;
|
||||
local $_;
|
||||
|
||||
my $first_line = $line_of_interest - $num_lines / 2;
|
||||
my $last_line = $first_line + $num_lines;
|
||||
|
||||
print "<a href='showlog.cgi?tree=$tree&logfile=$logfile&line="
|
||||
.($line_of_interest-$num_lines)."&numlines=$num_lines'>"
|
||||
."Previous $num_lines</a>";
|
||||
print "<font size='+1'><b>.<br>.<br>.<br></b></font>";
|
||||
print "<pre>";
|
||||
my $ii = 0;
|
||||
open BUILD_IN, "$gzip -d -c $tree/$logfile|";
|
||||
while (<BUILD_IN>) {
|
||||
$ii++;
|
||||
next if $ii < $first_line;
|
||||
last if $ii > $last_line;
|
||||
if ($ii == $line_of_intested) {
|
||||
print "<b>$_</b>";
|
||||
} else {
|
||||
print;
|
||||
}
|
||||
}
|
||||
close BUILD_IN;
|
||||
print "</pre>";
|
||||
print "<font size='+1'><b>.<br>.<br>.<br></b></font>";
|
||||
print "<a href='showlog.cgi?tree=$tree&logfile=$logfile&line="
|
||||
.($line_of_interest+$num_lines)."&numlines=$num_lines'>"
|
||||
."Next $num_lines</a>";
|
||||
}
|
||||
|
||||
sub print_log {
|
||||
#
|
||||
# reset the error counter
|
||||
#
|
||||
$next_err = 0;
|
||||
|
||||
logprint('<H2>Build Error Log</H2><pre>');
|
||||
|
||||
$log_line = 0;
|
||||
open( BUILD_IN, "$gzip -d -c $tree/$logfile|" );
|
||||
while( $line = <BUILD_IN> ){
|
||||
&output_log_line( $line );
|
||||
}
|
||||
close( BUILD_IN );
|
||||
|
||||
logprint('</PRE><p>'
|
||||
."<font size=+1><a name=\"err$next_err\">No More Errors</a></font>"
|
||||
.'<br><br><br>');
|
||||
}
|
||||
|
||||
sub output_summary_line {
|
||||
my( $line ) = $_[0];
|
||||
my( $has_error );
|
||||
|
||||
$has_error = &has_error( $line );
|
||||
|
||||
$line =~ s/&/&/g;
|
||||
$line =~ s/</</g;
|
||||
|
||||
if( $has_error ){
|
||||
push @log_errors, $log_line + $LINES_AFTER_ERROR;
|
||||
if( ! $last_was_error ) {
|
||||
logprint("<a href=\"#err$next_err\">$line</a>");
|
||||
$next_err++;
|
||||
}
|
||||
$last_was_error = 1;
|
||||
}
|
||||
else {
|
||||
$last_was_error = 0;
|
||||
}
|
||||
|
||||
$log_line++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub output_log_line {
|
||||
my( $line ) = $_[0];
|
||||
my( $has_error, $dur, $dur_min,$dur_sec, $dur_str, $logline );
|
||||
|
||||
$has_error = &has_error( $line );
|
||||
$has_warning = &has_warning( $line );
|
||||
|
||||
$line =~ s/&/&/g;
|
||||
$line =~ s/</</g;
|
||||
|
||||
$logline = '';
|
||||
|
||||
if( ($has_error || $has_warning) && &has_errorline( $line ) ) {
|
||||
$q = quotemeta( $error_file );
|
||||
#$goto_line = ($error_line ? 10 > $error_line - 10 : 1 );
|
||||
$goto_line = ($error_line > 10 ? $error_line - 10 : 1 );
|
||||
$cvsblame = ($error_guess ? "cvsguess.cgi" : "cvsblame.cgi");
|
||||
$line =~ s@$q@<a href=../bonsai/$cvsblame?file=$error_file_ref&rev=$cvs_branch&mark=$error_line#$goto_line $source_target>$error_file</a>@
|
||||
}
|
||||
|
||||
|
||||
if( $has_error ){
|
||||
if( ! $last_was_error ) {
|
||||
$logline .= "<a name=\"err$next_err\"></a>";
|
||||
$next_err++;
|
||||
$logline .= "<a href=\"#err$next_err\">NEXT</a> ";
|
||||
}
|
||||
else {
|
||||
$logline .= " ";
|
||||
}
|
||||
|
||||
$logline .= "<font color=\"000080\">$line</font>";
|
||||
|
||||
$last_was_error = 1;
|
||||
}
|
||||
elsif( $has_warning ){
|
||||
$logline .= " ";
|
||||
$logline .= "<font color=000080>$line</font>";
|
||||
}
|
||||
else {
|
||||
$logline .= " $line";
|
||||
$last_was_error = 0;
|
||||
}
|
||||
|
||||
&push_log_line( $logline );
|
||||
}
|
||||
|
||||
|
||||
sub push_log_line {
|
||||
my( $line ) = $_[0];
|
||||
if( $fulltext ){
|
||||
logprint($line);
|
||||
return;
|
||||
}
|
||||
|
||||
if( $log_line > $log_errors[$cur_error] ){
|
||||
$cur_error++;
|
||||
}
|
||||
|
||||
if( $log_line >= $log_errors[$cur_error] - $LINES_BEFORE_ERROR ){
|
||||
if( $log_skip != 0 ){
|
||||
logprint("\n<i><font size=+1> Skipping $log_skip Lines...</i></font>\n\n");
|
||||
$log_skip = 0;
|
||||
}
|
||||
logprint($line);
|
||||
}
|
||||
else {
|
||||
$log_skip++;
|
||||
}
|
||||
$log_line++;
|
||||
}
|
||||
|
||||
sub logprint {
|
||||
my $line = $_[0];
|
||||
print $line;
|
||||
print BRIEFFILE $line if not $fulltext;
|
||||
}
|
||||
BIN
mozilla/webtools/tinderbox/star.gif
Normal file
BIN
mozilla/webtools/tinderbox/star.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 227 B |
75
mozilla/webtools/tinderbox/tinderbox.spec
Normal file
75
mozilla/webtools/tinderbox/tinderbox.spec
Normal file
@@ -0,0 +1,75 @@
|
||||
# The contents of this file are subject to the Mozilla Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License
|
||||
# at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
# the License for the specific language governing rights and
|
||||
# limitations under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox CVS Tool rpm spec file.
|
||||
#
|
||||
# The Initial Developer of this code under the MPL is Christopher
|
||||
# Seawood, <cls@seawood.org>. Portions created by Christopher Seawood
|
||||
# are Copyright (C) 1998 Christopher Seawood. All Rights Reserved.
|
||||
|
||||
%define ver SNAP
|
||||
%define perl /usr/bin/perl
|
||||
%define cvsroot /cvsroot
|
||||
%define gzip /usr/bin/gzip
|
||||
%define uudecode /usr/bin/uudecode
|
||||
%define bonsai ../bonsai
|
||||
%define prefix /home/httpd/html/tinderbox
|
||||
# This rpm is not relocateable
|
||||
Summary: automated build tool
|
||||
Name: tinderbox
|
||||
Version: %{ver}
|
||||
Release: 1
|
||||
Copyright: NPL
|
||||
Group: Networking/Admin
|
||||
Source: %{name}-%{ver}.tar.gz
|
||||
BuildRoot: /var/tmp/build-%{name}
|
||||
Requires: bonsai
|
||||
Packager: Christopher Seawood <cls@seawood.org>
|
||||
|
||||
%changelog
|
||||
* Thu Nov 12 1998 Christopher Seawood <cls@seawood.org>
|
||||
- Replaced ver with SNAP
|
||||
|
||||
* Mon Oct 26 1998 Christopher Seawood <cls@seawood.org>
|
||||
- Added MPL header
|
||||
|
||||
* Sun Aug 31 1998 Christopher Seawood <cls@seawood.org>
|
||||
- Made rpm from cvs snapshot
|
||||
|
||||
%description
|
||||
Essentially, Tinderbox is a detective tool. It allows you to see what
|
||||
is happening in the source tree. It shows you who checked in what (by
|
||||
asking Bonsai); what platforms have built successfully; what platforms
|
||||
are broken and exactly how they are broken (the build logs); and the
|
||||
state of the files that made up the build (cvsblame) so you can figure
|
||||
out who broke the build, so you can do the most important thing, hold
|
||||
them accountable for their actions.
|
||||
|
||||
%prep
|
||||
%setup -n %{name}
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{prefix}/{data,examples}
|
||||
make install PERL=%perl UUDECODE=%uudecode GZIP=%gzip BONSAI=%bonsai CVSROOT=%cvsroot PREFIX=${RPM_BUILD_ROOT}%prefix
|
||||
|
||||
%post
|
||||
echo "Remember to set the admin passwd via '%{bonsai}/data/trapdoor password > %{prefix}/data/passwd"
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr (-, nobody, nobody)
|
||||
%doc README Makefile
|
||||
%{prefix}
|
||||
|
||||
123
mozilla/webtools/tinderbox/viewallnotes.cgi
Executable file
123
mozilla/webtools/tinderbox/viewallnotes.cgi
Executable file
@@ -0,0 +1,123 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
use lib '../bonsai';
|
||||
require "globals.pl";
|
||||
require 'lloydcgi.pl';
|
||||
require 'header.pl';
|
||||
|
||||
use Date::Parse;
|
||||
use Date::Format;
|
||||
|
||||
my $TIMEFORMAT = "%D %T";
|
||||
|
||||
$| = 1;
|
||||
|
||||
print "Content-type: text/html\n\n<HTML>\n";
|
||||
|
||||
my $tree = $form{'tree'};
|
||||
my $start = $form{'start'};
|
||||
my $end = $form{'end'};
|
||||
|
||||
sub str2timeAndCheck {
|
||||
my ($str) = (@_);
|
||||
my $result = str2time($str);
|
||||
if (defined $result && $result > 7000000) {
|
||||
return $result;
|
||||
}
|
||||
print "<p><font color=red>Can't parse as a date: $str</font><p>\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $header = "<table border=1><th>Build time</th><th>Build name</th><th>Who</th><th>Note time</th><th>Note</th>";
|
||||
|
||||
if (defined $tree && defined $start && defined $end) {
|
||||
my $first = str2timeAndCheck($start);
|
||||
my $last = str2timeAndCheck($end);
|
||||
if ($first > 0 && $last > 0) {
|
||||
if (open(IN, "<$tree/notes.txt")) {
|
||||
print "<hr><center><h1>Notes for $tree</H1><H3>from " .
|
||||
time2str($TIMEFORMAT, $first) . " to " .
|
||||
time2str($TIMEFORMAT, $last) . "</H3></center>\n";
|
||||
my %stats;
|
||||
print "$header\n";
|
||||
while (<IN>) {
|
||||
chop;
|
||||
my ($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note)
|
||||
= split /\|/;
|
||||
if ($nbuildtime >= $first && $nbuildtime <= $last) {
|
||||
my $note = &url_decode($nenc_note);
|
||||
$nbuildtime = print_time($nbuildtime);
|
||||
$nnow = print_time($nnow);
|
||||
print "<tr>";
|
||||
print "<td>$nbuildtime</td>";
|
||||
print "<td>$nbuildname</td>";
|
||||
print "<td>$nwho</td>";
|
||||
print "<td>$nnow</td>";
|
||||
print "<td>$note</td>";
|
||||
print "</tr>\n";
|
||||
if (++$count % 100 == 0) {
|
||||
print "</table>$header\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "<p><font color=red>There does not appear to be a tree " .
|
||||
"named '$tree'.</font><p>";
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
if (!defined $tree) {
|
||||
$tree = "";
|
||||
}
|
||||
|
||||
if (!defined $start) {
|
||||
$start = time2str($TIMEFORMAT, time() - 7*24*60*60); # One week ago.
|
||||
}
|
||||
|
||||
|
||||
if (!defined $end) {
|
||||
$end = time2str($TIMEFORMAT, time()); # #now
|
||||
}
|
||||
|
||||
print qq|
|
||||
<form>
|
||||
<table>
|
||||
<tr>
|
||||
<th align=right>Tree:</th>
|
||||
<td><input name=tree size=30 value="$tree"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=right>Start time:</th>
|
||||
<td><input name=start size=30 value="$start"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=right>End time:</th>
|
||||
<td><input name=end size=30 value="$end"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<INPUT TYPE=\"submit\" VALUE=\"View Notes \">
|
||||
|
||||
</form>
|
||||
|;
|
||||
437
mozilla/webtools/tinderbox/warnings.pl
Executable file
437
mozilla/webtools/tinderbox/warnings.pl
Executable file
@@ -0,0 +1,437 @@
|
||||
#! /usr/bonsaitools/bin/perl
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License
|
||||
# Version 1.1 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS"
|
||||
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing rights and limitations
|
||||
# under the License.
|
||||
#
|
||||
# The Original Code is Tinderbox
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1999
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Stephen Lamm <slamm@mozilla.org>
|
||||
|
||||
use FileHandle;
|
||||
|
||||
$tree = 'SeaMonkey';
|
||||
# tinderbox/globals.pl uses many shameful globals
|
||||
$form{tree} = $tree;
|
||||
require 'globals.pl';
|
||||
|
||||
$cvsroot = '/cvsroot/mozilla';
|
||||
$lxr_data_root = '/export2/lxr-data';
|
||||
@ignore = (
|
||||
'long long',
|
||||
'__cmsg_data',
|
||||
'location of the previous definition',
|
||||
'\' was hidden',
|
||||
'declaration of \`index\'',
|
||||
);
|
||||
$ignore_pat = "(?:".join('|',@ignore).")";
|
||||
|
||||
print STDERR "Building hash of file names...";
|
||||
($file_bases, $file_fullpaths) = build_file_hash($cvsroot, $tree);
|
||||
print STDERR "done.\n";
|
||||
|
||||
for $br (last_successful_builds($tree)) {
|
||||
next unless $br->{buildname} =~ /shrike.*\b(Clobber|Clbr)\b/;
|
||||
|
||||
my $log_file = "$br->{logfile}";
|
||||
|
||||
warn "Parsing build log, $log_file\n";
|
||||
|
||||
$fh = new FileHandle "gunzip -c $tree/$log_file |";
|
||||
&gcc_parser($fh, $cvsroot, $tree, $log_file, $file_bases, $file_fullpaths);
|
||||
$fh->close;
|
||||
|
||||
&build_blame;
|
||||
|
||||
my $warn_file = "$tree/warn$log_file";
|
||||
$warn_file =~ s/.gz$/.html/;
|
||||
|
||||
$fh->open(">$warn_file") or die "Unable to open $warn_file: $!\n";
|
||||
&print_warnings_as_html($fh, $br);
|
||||
$fh->close;
|
||||
warn "Wrote output to $warn_file\n";
|
||||
|
||||
last;
|
||||
}
|
||||
|
||||
# end of main
|
||||
# ===================================================================
|
||||
|
||||
sub build_file_hash {
|
||||
my ($cvsroot, $tree) = @_;
|
||||
|
||||
$lxr_data_root = "/export2/lxr-data/\L$tree";
|
||||
|
||||
$lxr_file_list = "\L$lxr_data_root/.glimpse_filenames";
|
||||
open(LXR_FILENAMES, "<$lxr_file_list")
|
||||
or die "Unable to open $lxr_file_list: $!\n";
|
||||
|
||||
use File::Basename;
|
||||
|
||||
while (<LXR_FILENAMES>) {
|
||||
my ($base, $dir, $ext) = fileparse($_,'\.[^/]*');
|
||||
|
||||
next unless $ext =~ /^\.(cpp|h|C|s|c|mk|in)$/;
|
||||
|
||||
$base = "$base$ext";
|
||||
$dir =~ s|$lxr_data_root/mozilla/||;
|
||||
$dir =~ s|/$||;
|
||||
|
||||
$fullpath{"$dir/$base"}=1;
|
||||
|
||||
unless (exists $bases{$base}) {
|
||||
$bases{$base} = $dir;
|
||||
} else {
|
||||
$bases{$base} = '[multiple]';
|
||||
}
|
||||
}
|
||||
return \%bases, \%fullpath;
|
||||
}
|
||||
|
||||
sub last_successful_builds {
|
||||
my $tree = shift;
|
||||
my @build_records = ();
|
||||
my $br;
|
||||
|
||||
|
||||
$maxdate = time;
|
||||
$mindate = $maxdate - 5*60*60; # Go back 5 hours
|
||||
|
||||
print STDERR "Loading build data...";
|
||||
&load_data;
|
||||
print STDERR "done\n";
|
||||
|
||||
for (my $ii=1; $ii <= $name_count; $ii++) {
|
||||
for (my $tt=1; $tt <= $time_count; $tt++) {
|
||||
if (defined($br = $build_table->[$tt][$ii])
|
||||
and $br->{buildstatus} eq 'success') {
|
||||
push @build_records, $br;
|
||||
last;
|
||||
} } }
|
||||
return @build_records;
|
||||
}
|
||||
|
||||
sub gcc_parser {
|
||||
my ($fh, $cvsroot, $tree, $log_file, $file_bases, $file_fullnames) = @_;
|
||||
my $dir = '';
|
||||
|
||||
while (<$fh>) {
|
||||
# Directory
|
||||
#
|
||||
if (/^gmake\[\d\]: Entering directory \`(.*)\'$/) {
|
||||
($build_dir = $1) =~ s|.*/mozilla/||;
|
||||
next;
|
||||
}
|
||||
|
||||
# Now only match lines with "warning:"
|
||||
next unless /warning:/;
|
||||
next if /$ignore_pat/o;
|
||||
|
||||
chomp; # Yum, yum
|
||||
|
||||
my ($filename, $line, $warning_text);
|
||||
($filename, $line, undef, $warning_text) = split /:\s*/, $_, 4;
|
||||
$filename =~ s/.*\///;
|
||||
|
||||
# Special case for Makefiles
|
||||
$filename =~ s/Makefile$/Makefile.in/;
|
||||
|
||||
my $dir = '';
|
||||
if ($file_fullnames->{"$build_dir/$filename"}) {
|
||||
$dir = $build_dir;
|
||||
} else {
|
||||
unless(defined($dir = $file_bases->{$filename})) {
|
||||
$dir = '[no_match]';
|
||||
}
|
||||
}
|
||||
my $file = "$dir/$filename";
|
||||
|
||||
unless (defined($warnings{$file}{$line})) {
|
||||
|
||||
# Special case for "`foo' was hidden\nby `foo2'"
|
||||
$warning_text = "...was hidden " . $warning_text
|
||||
if $warning_text =~ /^by \`/;
|
||||
|
||||
# Remember where in the build log the warning occured
|
||||
$warnings{$file}{$line} = {
|
||||
first_seen_line => $.,
|
||||
log_file => $log_file,
|
||||
warning_text => $warning_text,
|
||||
};
|
||||
}
|
||||
$warnings{$file}{$line}->{count}++;
|
||||
$total_warnings_count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub dump_warning_data {
|
||||
while (my ($file, $lines_hash) = each %warnings) {
|
||||
while (my ($line, $record) = each %{$lines_hash}) {
|
||||
print join ':',
|
||||
$file,$line,
|
||||
$record->{first_seen_line},
|
||||
$record->{count},
|
||||
$record->{warning_text};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub build_blame {
|
||||
use lib '../bonsai';
|
||||
require 'utils.pl';
|
||||
require 'cvsblame.pl';
|
||||
|
||||
while (($file, $lines_hash) = each %warnings) {
|
||||
|
||||
my $rcs_filename = "$cvsroot/$file,v";
|
||||
|
||||
unless (-e $rcs_filename) {
|
||||
warn "Unable to find $rcs_filename\n";
|
||||
$unblamed{$file} = 1;
|
||||
next;
|
||||
}
|
||||
|
||||
my $revision = &parse_cvs_file($rcs_filename);
|
||||
@text = &extract_revision($revision);
|
||||
while (my ($line, $warn_rec) = each %{$lines_hash}) {
|
||||
my $line_rev = $revision_map[$line-1];
|
||||
my $who = $revision_author{$line_rev};
|
||||
my $source_text = join '', @text[$line-3..$line+1];
|
||||
$source_text =~ s/\t/ /g;
|
||||
|
||||
$who = "$who%netscape.com" unless $who =~ /[%]/;
|
||||
|
||||
$warn_rec->{line_rev} = $line_rev;
|
||||
$warn_rec->{source} = $source_text;
|
||||
|
||||
$warnings_by_who{$who}{$file}{$line} = $warn_rec;
|
||||
|
||||
$total_who_count++ unless exists $who_count{$who};
|
||||
$who_count{$who} += $warn_rec->{count};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub print_warnings_as_html {
|
||||
my ($fh, $br) = @_;
|
||||
my ($buildname, $buildtime) = ($br->{buildname}, $br->{buildtime});
|
||||
|
||||
my $time_str = print_time( $buildtime );
|
||||
|
||||
# Change the default destination for print to $fh
|
||||
my $old_fh = select($fh);
|
||||
|
||||
print <<"__END_HEADER";
|
||||
<html>
|
||||
<head>
|
||||
<title>Blamed Build Warnings</title>
|
||||
</head>
|
||||
<body>
|
||||
<font size="+2" face="Helvetica,Arial"><b>
|
||||
Blamed Build Warnings
|
||||
</b></font><br>
|
||||
<font size="+1" face="Helvetica,Arial">
|
||||
$buildname on $time_str<br>
|
||||
$total_warnings_count total warnings
|
||||
</font><p>
|
||||
|
||||
__END_HEADER
|
||||
|
||||
for $who (sort { $who_count{$b} <=> $who_count{$a}
|
||||
|| $a cmp $b } keys %who_count) {
|
||||
push @who_list, $who;
|
||||
}
|
||||
|
||||
# Summary Table (name, count)
|
||||
#
|
||||
use POSIX;
|
||||
print "<table border=0 cellpadding=1 cellspacing=0 bgcolor=#ededed>\n";
|
||||
my $num_columns = 6;
|
||||
my $num_rows = ceil($#who_list / $num_columns);
|
||||
for (my $ii=0; $ii < $num_rows; $ii++) {
|
||||
print "<tr>";
|
||||
for (my $jj=0; $jj < $num_columns; $jj++) {
|
||||
my $index = $ii + $jj * $num_rows;
|
||||
next if $index > $#who_list;
|
||||
my $name = $who_list[$index];
|
||||
my $count = $who_count{$name};
|
||||
$name =~ s/%.*//;
|
||||
print " " x $jj;
|
||||
print "<td><a href='#$name'>$name</a>";
|
||||
print "</td><td>";
|
||||
print "$count";
|
||||
print "</td><td> </td>\n";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table><p>\n";
|
||||
|
||||
# Count Unblamed warnings
|
||||
#
|
||||
my $total_unblamed_warnigns=0;
|
||||
for my $file (keys %unblamed) {
|
||||
for my $linenum (keys %{$warnings{$file}}) {
|
||||
$total_unblamed_warnings += $warnings{$file}{$linenum}{count};
|
||||
$warnings_by_who{Unblamed}{$file}{$linenum} = $warnings{$file}{$linenum};
|
||||
}
|
||||
}
|
||||
$who_count{Unblamed} = $total_unblamed_warnings;
|
||||
|
||||
# Print all the warnings
|
||||
#
|
||||
for $who (@who_list, "Unblamed") {
|
||||
my $total_count = $who_count{$who};
|
||||
my ($name, $email);
|
||||
($name = $who) =~ s/%.*//;
|
||||
($email = $who) =~ s/%/@/;
|
||||
|
||||
print "<h2>";
|
||||
print "<a name='$name' href='mailto:$email'>" unless $name eq 'Unblamed';
|
||||
print "$name";
|
||||
print "</a>" unless $name eq 'Unblamed';
|
||||
print " (1 warning)" if $total_count == 1;
|
||||
print " ($total_count warnings)" if $total_count > 1;
|
||||
print "</h2>";
|
||||
|
||||
print "\n<table>\n";
|
||||
my $count = 1;
|
||||
for $file (sort keys %{$warnings_by_who{$who}}) {
|
||||
for $linenum (sort keys %{$warnings_by_who{$who}{$file}}) {
|
||||
my $warn_rec = $warnings_by_who{$who}{$file}{$linenum};
|
||||
print_count($count, $warn_rec->{count});
|
||||
print_warning($tree, $br, $file, $linenum, $warn_rec);
|
||||
print_source_code($linenum, $warn_rec) unless $unblamed{$file};
|
||||
$count += $warn_rec->{count};
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
print <<"__END_FOOTER";
|
||||
<p>
|
||||
<hr align=left>
|
||||
Send questions or comments to
|
||||
<<a href="mailto:slamm\@netscape.com?subject=About the Blamed Build Warnings">slamm\@netcape.com</a>>.
|
||||
</body></html>
|
||||
__END_FOOTER
|
||||
|
||||
# Change default destination back.
|
||||
select($old_fh);
|
||||
}
|
||||
|
||||
sub print_count {
|
||||
my ($start, $count) = @_;
|
||||
|
||||
print "<tr><td align=right>$start";
|
||||
print "-".($start+$count-1) if $count > 1;
|
||||
print ".</td>";
|
||||
}
|
||||
|
||||
sub print_warning {
|
||||
my ($tree, $br, $file, $linenum, $warn_rec) = @_;
|
||||
|
||||
my $warning = $warn_rec->{warning_text};
|
||||
|
||||
print "<td>";
|
||||
|
||||
# File link
|
||||
if ($file =~ /\[multiple\]/) {
|
||||
$file =~ s/\[multiple\]\///;
|
||||
print "<a href='http://lxr.mozilla.org/seamonkey/find?string=$file'>";
|
||||
print "$file:$linenum";
|
||||
print "</a> (multiple file matches)";
|
||||
} elsif ($file =~ /\[no_match\]/) {
|
||||
$file =~ s/\[no_match\]\///;
|
||||
print "<b>$file:$linenum</b> (no file match)";
|
||||
} else {
|
||||
print "<a href='"
|
||||
.file_url($file,$linenum)."'>";
|
||||
print "$file:$linenum";
|
||||
print "</a> ";
|
||||
}
|
||||
print "</td></tr><tr><td></td><td>";
|
||||
# Warning text
|
||||
print "\u$warning";
|
||||
# Build log link
|
||||
my $log_line = $warn_rec->{first_seen_line};
|
||||
print " (<a href='"
|
||||
.build_url($tree, $br, $log_line)
|
||||
."'>";
|
||||
if ($warn_rec->{count} == 1) {
|
||||
print "See build log excerpt";
|
||||
} else {
|
||||
print "See 1st of $warn_rec->{count} occurrences in build log";
|
||||
}
|
||||
print "</a>)</td></tr>";
|
||||
}
|
||||
|
||||
sub print_source_code {
|
||||
my ($linenum, $warn_rec) = @_;
|
||||
my $warning = $warn_rec->{warning_text};
|
||||
|
||||
# Source code fragment
|
||||
#
|
||||
my ($keyword) = $warning =~ /\`([^\']*)\'/;
|
||||
print "<tr><td></td><td bgcolor=#ededed>";
|
||||
print "<pre><font size='-1'>";
|
||||
|
||||
my $source_text = trim_common_leading_whitespace($warn_rec->{source});
|
||||
$source_text =~ s/&/&/gm;
|
||||
$source_text =~ s/</</gm;
|
||||
$source_text =~ s/>/>/gm;
|
||||
$source_text =~ s|\b\Q$keyword\E\b|<b>$keyword</b>|gm unless $keyword eq '';
|
||||
my $line_index = $linenum - 2;
|
||||
$source_text =~ s/^(.*)$/$line_index++." $1"/gme;
|
||||
$source_text =~ s|^($linenum.*)$|<font color='red'>\1</font>|gm;
|
||||
chomp $source_text;
|
||||
print $source_text;
|
||||
|
||||
print "</font>";
|
||||
#print "</pre>";
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
sub build_url {
|
||||
my ($tree, $br, $linenum) = @_;
|
||||
|
||||
my $name = $br->{buildname};
|
||||
$name =~ s/ /%20/g;
|
||||
|
||||
return "../showlog.cgi?log=$tree/$br->{logfile}:$linenum";
|
||||
}
|
||||
|
||||
sub file_url {
|
||||
my ($file, $linenum) = @_;
|
||||
|
||||
return "http://cvs-mirror.mozilla.org/webtools/bonsai/cvsblame.cgi"
|
||||
."?file=mozilla/$file&mark=$linenum#".($linenum-10);
|
||||
|
||||
}
|
||||
|
||||
sub trim_common_leading_whitespace {
|
||||
# Adapted from dequote() in Perl Cookbook by Christiansen and Torkington
|
||||
local $_ = shift;
|
||||
my $white; # common whitespace
|
||||
if (/(?:(\s*).*\n)(?:(?:\1.*\n)|(?:\s*\n))+$/) {
|
||||
$white = $1;
|
||||
} else {
|
||||
$white = /^(\s+)/;
|
||||
}
|
||||
s/^(?:$white)?//gm;
|
||||
s/^\s+$//gm;
|
||||
return $_;
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
rem -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
rem
|
||||
rem The contents of this file are subject to the Netscape Public License
|
||||
rem Version 1.0 (the "NPL"); you may not use this file except in
|
||||
rem compliance with the NPL. You may obtain a copy of the NPL at
|
||||
rem http://www.mozilla.org/NPL/
|
||||
rem
|
||||
rem Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
rem WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
rem for the specific language governing rights and limitations under the
|
||||
rem NPL.
|
||||
rem
|
||||
rem The Initial Developer of this code under the NPL is Netscape
|
||||
rem Communications Corporation. Portions created by Netscape are
|
||||
rem Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
rem Reserved.
|
||||
rem
|
||||
|
||||
del s:\ns\raptor\ui\src\windows\win32_d.obj\%1.obj
|
||||
del s:\ns\raptor\ui\tests\windows\win32_d.obj\winmain.obj
|
||||
nmake -f makefile.win
|
||||
@@ -1,11 +0,0 @@
|
||||
//
|
||||
// Widget.Prefix
|
||||
//
|
||||
// Global prefix file for the Widget project.
|
||||
//
|
||||
|
||||
#include "MacPrefix.h"
|
||||
|
||||
#include <Quickdraw.h>
|
||||
#include <Events.h>
|
||||
#include <MacWindows.h>
|
||||
@@ -1,11 +0,0 @@
|
||||
//
|
||||
// WidgetDebug.Prefix
|
||||
//
|
||||
// Global prefix file for the debug Widget project.
|
||||
//
|
||||
|
||||
#include "MacPrefix_debug.h"
|
||||
|
||||
#include <Quickdraw.h>
|
||||
#include <Events.h>
|
||||
#include <MacWindows.h>
|
||||
@@ -1,22 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_SHARED 1
|
||||
#define _IMPL_NS_WIDGET 1
|
||||
|
||||
#include "WidgetDebug.prefix"
|
||||
@@ -1,22 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_SHARED 1
|
||||
#define _IMPL_NS_WIDGET 1
|
||||
|
||||
#include "Widget.prefix"
|
||||
@@ -1,21 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_STATIC 1
|
||||
|
||||
#include "WidgetDebug.prefix"
|
||||
@@ -1,21 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_STATIC 1
|
||||
|
||||
#include "Widget.prefix"
|
||||
Binary file not shown.
@@ -1,35 +0,0 @@
|
||||
# target: widgetDebug.shlb
|
||||
mozilla/widget/src/mac/nsAppShell.cpp
|
||||
mozilla/widget/src/mac/nsButton.cpp
|
||||
mozilla/widget/src/mac/nsCheckButton.cpp
|
||||
mozilla/widget/src/mac/nsFileWidget.cpp
|
||||
mozilla/widget/src/mac/nsLookAndFeel.cpp
|
||||
mozilla/widget/src/mac/nsMacControl.cpp
|
||||
mozilla/widget/src/mac/nsMacEventHandler.cpp
|
||||
mozilla/widget/src/mac/nsMacMessagePump.cpp
|
||||
mozilla/widget/src/mac/nsMacMessageSink.cpp
|
||||
mozilla/widget/src/mac/nsMacWindow.cpp
|
||||
mozilla/widget/src/mac/nsMenu.cpp
|
||||
mozilla/widget/src/mac/nsMenuBar.cpp
|
||||
mozilla/widget/src/mac/nsMenuItem.cpp
|
||||
mozilla/widget/src/mac/nsRadioButton.cpp
|
||||
mozilla/widget/src/mac/nsScrollbar.cpp
|
||||
mozilla/widget/src/mac/nsTextAreaWidget.cpp
|
||||
mozilla/widget/src/mac/nsTextWidget.cpp
|
||||
mozilla/widget/src/mac/nsToolkit.cpp
|
||||
mozilla/widget/src/mac/nsWidgetFactory.cpp
|
||||
mozilla/widget/src/mac/nsWidgetSupport.cpp
|
||||
mozilla/widget/src/mac/nsWindow.cpp
|
||||
mozilla/widget/src/xpwidgets/nsBaseWidget.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTColumn.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTControlStripItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTDataModel.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTTreeDataModel.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTTreeItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsImageButton.cpp
|
||||
mozilla/widget/src/xpwidgets/nsMenuButton.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbar.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbarItemHolder.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbarManager.cpp
|
||||
mozilla/widget/src/xpwidgets/nsTreeView.cpp
|
||||
Binary file not shown.
@@ -1,23 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..
|
||||
|
||||
|
||||
DIRS=public timer src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,33 +0,0 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:widget directory
|
||||
#
|
||||
|
||||
nsIDragSessionMac.h
|
||||
nsIWidget.h
|
||||
nsIKBStateControl.h
|
||||
nsIButton.h
|
||||
nsICheckButton.h
|
||||
nsIListWidget.h
|
||||
nsIComboBox.h
|
||||
nsITextWidget.h
|
||||
nsITextAreaWidget.h
|
||||
nsIComboBox.h
|
||||
nsIListBox.h
|
||||
nsIScrollbar.h
|
||||
nsGUIEvent.h
|
||||
nsIRadioButton.h
|
||||
nsIMouseListener.h
|
||||
nsIEventListener.h
|
||||
nsIFileWidget.h
|
||||
nsIMenuListener.h
|
||||
nsWidgetsCID.h
|
||||
nsILabel.h
|
||||
nsILookAndFeel.h
|
||||
nsWidgetSupport.h
|
||||
nsIMenu.h
|
||||
nsIMenuBar.h
|
||||
nsIMenuItem.h
|
||||
nsIPopUpMenu.h
|
||||
nsIKeyBindMgr.h
|
||||
nsStringUtil.h
|
||||
nsIContextMenu.h
|
||||
@@ -1,16 +0,0 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:idl directory
|
||||
#
|
||||
|
||||
nsIAppShell.idl
|
||||
nsIFilePicker.idl
|
||||
nsIFileSpecWithUI.idl
|
||||
nsISound.idl
|
||||
nsIToolkit.idl
|
||||
nsITransferable.idl
|
||||
nsIDragSession.idl
|
||||
nsIDragService.idl
|
||||
nsIFormatConverter.idl
|
||||
nsIClipboard.idl
|
||||
nsIClipboardOwner.idl
|
||||
nsIRollupListener.idl
|
||||
@@ -1,92 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = raptor
|
||||
XPIDL_MODULE = widget
|
||||
|
||||
EXPORTS = \
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIPopUpMenu.h \
|
||||
nsIFileWidget.h \
|
||||
nsStringUtil.h \
|
||||
nsIKBStateControl.h \
|
||||
nsIButton.h \
|
||||
nsICheckButton.h \
|
||||
nsIListWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsITextWidget.h \
|
||||
nsITextAreaWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsIListBox.h \
|
||||
nsIScrollbar.h \
|
||||
nsGUIEvent.h \
|
||||
nsIRadioButton.h \
|
||||
nsIMouseListener.h \
|
||||
nsIEventListener.h \
|
||||
nsIMenuListener.h \
|
||||
nsWidgetsCID.h \
|
||||
nsILookAndFeel.h \
|
||||
nsILabel.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIPopUpMenu.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIContextMenu.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAppShell.idl \
|
||||
nsIFilePicker.idl \
|
||||
nsIFileSpecWithUI.idl \
|
||||
nsIToolkit.idl \
|
||||
nsISound.idl \
|
||||
nsITransferable.idl \
|
||||
nsIDragSession.idl \
|
||||
nsIDragService.idl \
|
||||
nsIFormatConverter.idl \
|
||||
nsIClipboard.idl \
|
||||
nsIClipboardOwner.idl \
|
||||
nsIRollupListener.idl \
|
||||
nsIWidget.idl \
|
||||
nsIWindow.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_UI
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
|
||||
|
||||
DEFINES=-D_IMPL_NS_UI
|
||||
MODULE=raptor
|
||||
XPIDL_MODULE=widget
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIAppShell.idl \
|
||||
.\nsIFilePicker.idl \
|
||||
.\nsIFileSpecWithUI.idl \
|
||||
.\nsISound.idl \
|
||||
.\nsIToolkit.idl \
|
||||
.\nsITransferable.idl \
|
||||
.\nsIDragSession.idl \
|
||||
.\nsIDragService.idl \
|
||||
.\nsIFormatConverter.idl \
|
||||
.\nsIClipboard.idl \
|
||||
.\nsIClipboardOwner.idl \
|
||||
.\nsIRollupListener.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS=\
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIFileWidget.h \
|
||||
nsIWidget.h \
|
||||
nsIKBStateControl.h \
|
||||
nsIButton.h \
|
||||
nsICheckButton.h \
|
||||
nsIListWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsITextWidget.h \
|
||||
nsITextAreaWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsIListBox.h \
|
||||
nsIScrollbar.h \
|
||||
nsGUIEvent.h \
|
||||
nsIRadioButton.h \
|
||||
nsIMouseListener.h \
|
||||
nsIEventListener.h \
|
||||
nsIMenuListener.h \
|
||||
nsWidgetsCID.h \
|
||||
nsStringUtil.h \
|
||||
nsILookAndFeel.h \
|
||||
nsILabel.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIContextMenu.h \
|
||||
nsIPopUpMenu.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -1,509 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsGUIEvent_h__
|
||||
#define nsGUIEvent_h__
|
||||
|
||||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIRenderingContext;
|
||||
class nsIRegion;
|
||||
class nsIWidget;
|
||||
class nsIMenuItem;
|
||||
|
||||
/**
|
||||
* Return status for event processors.
|
||||
*/
|
||||
|
||||
enum nsEventStatus {
|
||||
/// The event is ignored, do default processing
|
||||
nsEventStatus_eIgnore,
|
||||
/// The event is consumed, don't do default processing
|
||||
nsEventStatus_eConsumeNoDefault,
|
||||
/// The event is consumed, but do default processing
|
||||
nsEventStatus_eConsumeDoDefault
|
||||
};
|
||||
|
||||
/**
|
||||
* General event
|
||||
*/
|
||||
|
||||
struct nsEvent {
|
||||
/// See event struct types
|
||||
PRUint8 eventStructType;
|
||||
/// See GUI MESSAGES,
|
||||
PRUint32 message;
|
||||
/// in widget relative coordinates, modified to be relative to current view in layout.
|
||||
nsPoint point;
|
||||
// in widget relative coordinates, not modified by layout code.
|
||||
nsPoint refPoint;
|
||||
/// elapsed time, in milliseconds, from the time the system was started to the time the message was created
|
||||
PRUint32 time;
|
||||
// flags to hold event flow stage and capture/bubble cancellation status
|
||||
PRUint32 flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* General graphic user interface event
|
||||
*/
|
||||
|
||||
struct nsGUIEvent : public nsEvent {
|
||||
/// Originator of the event
|
||||
nsIWidget* widget;
|
||||
/// Internal platform specific message.
|
||||
void* nativeMsg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window resize event
|
||||
*/
|
||||
|
||||
struct nsSizeEvent : public nsGUIEvent {
|
||||
/// x,y width, height in pixels (client area)
|
||||
nsRect *windowSize;
|
||||
/// width of entire window (in pixels)
|
||||
PRInt32 mWinWidth;
|
||||
/// height of entire window (in pixels)
|
||||
PRInt32 mWinHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window repaint event
|
||||
*/
|
||||
|
||||
struct nsPaintEvent : public nsGUIEvent {
|
||||
/// Context to paint in.
|
||||
nsIRenderingContext *renderingContext;
|
||||
/// area to paint (should be used instead of rect)
|
||||
nsIRegion *region;
|
||||
/// x,y, width, height in pixels of area to paint
|
||||
nsRect *rect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrollbar event
|
||||
*/
|
||||
|
||||
struct nsScrollbarEvent : public nsGUIEvent {
|
||||
/// ranges between scrollbar 0 and (maxRange - thumbSize). See nsIScrollbar
|
||||
PRUint32 position;
|
||||
};
|
||||
|
||||
|
||||
struct nsInputEvent : public nsGUIEvent {
|
||||
/// PR_TRUE indicates the shift key is down
|
||||
PRBool isShift;
|
||||
/// PR_TRUE indicates the control key is down
|
||||
PRBool isControl;
|
||||
/// PR_TRUE indicates the alt key is down
|
||||
PRBool isAlt;
|
||||
/// PR_TRUE indicates the meta key is down
|
||||
/// (or, on Mac, the Command key)
|
||||
PRBool isMeta;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mouse event
|
||||
*/
|
||||
|
||||
struct nsMouseEvent : public nsInputEvent {
|
||||
/// The number of mouse clicks
|
||||
PRUint32 clickCount;
|
||||
/// Special return code for MOUSE_ACTIVATE to signal
|
||||
/// if the target accepts activation (1), or denies it (0)
|
||||
PRBool acceptActivation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Keyboard event
|
||||
*/
|
||||
|
||||
struct nsKeyEvent : public nsInputEvent {
|
||||
/// see NS_VK codes
|
||||
PRUint32 keyCode;
|
||||
/// OS translated Unicode char
|
||||
PRUint32 charCode;
|
||||
// indicates whether the event signifies a printable character
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
/**
|
||||
* IME Related Events
|
||||
*/
|
||||
struct nsTextRange {
|
||||
PRUint32 mStartOffset;
|
||||
PRUint32 mEndOffset;
|
||||
PRUint32 mRangeType;
|
||||
};
|
||||
|
||||
typedef struct nsTextRange nsTextRange;
|
||||
typedef nsTextRange* nsTextRangeArray;
|
||||
|
||||
struct nsTextEventReply {
|
||||
nsPoint mCursorPosition;
|
||||
PRBool mCursorIsCollapsed;
|
||||
};
|
||||
|
||||
typedef struct nsTextEventReply nsTextEventReply;
|
||||
|
||||
struct nsTextEvent : public nsInputEvent {
|
||||
PRUnichar* theText;
|
||||
nsTextEventReply theReply;
|
||||
PRUint32 rangeCount;
|
||||
nsTextRangeArray rangeArray;
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
struct nsCompositionEvent : public nsInputEvent {
|
||||
PRUint32 compositionMessage;
|
||||
nsTextEventReply theReply;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tooltip event
|
||||
*/
|
||||
struct nsTooltipEvent : public nsGUIEvent {
|
||||
/// Index of tooltip area which generated the event. @see SetTooltips in nsIWidget
|
||||
PRUint32 tipIndex;
|
||||
};
|
||||
|
||||
/**
|
||||
* MenuItem event
|
||||
*
|
||||
* When this event occurs the widget field in nsGUIEvent holds the "target"
|
||||
* for the event
|
||||
*/
|
||||
|
||||
struct nsMenuEvent : public nsGUIEvent {
|
||||
nsIMenuItem * mMenuItem;
|
||||
PRUint32 mCommand;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event status for D&D Event
|
||||
*/
|
||||
enum nsDragDropEventStatus {
|
||||
/// The event is a enter
|
||||
nsDragDropEventStatus_eDragEntered,
|
||||
/// The event is exit
|
||||
nsDragDropEventStatus_eDragExited,
|
||||
/// The event is drop
|
||||
nsDragDropEventStatus_eDrop
|
||||
};
|
||||
|
||||
/**
|
||||
* Event Struct Types
|
||||
*/
|
||||
#define NS_EVENT 1
|
||||
#define NS_GUI_EVENT 2
|
||||
#define NS_SIZE_EVENT 3
|
||||
#define NS_PAINT_EVENT 4
|
||||
#define NS_SCROLLBAR_EVENT 5
|
||||
#define NS_INPUT_EVENT 6
|
||||
#define NS_KEY_EVENT 7
|
||||
#define NS_MOUSE_EVENT 8
|
||||
|
||||
#define NS_MENU_EVENT 10
|
||||
#define NS_DRAGDROP_EVENT 11
|
||||
#define NS_TEXT_EVENT 12
|
||||
#define NS_COMPOSITION_START 13
|
||||
#define NS_COMPOSITION_END 14
|
||||
|
||||
/**
|
||||
* GUI MESSAGES
|
||||
*/
|
||||
//@{
|
||||
|
||||
#define NS_WINDOW_START 100
|
||||
|
||||
// Widget is being created
|
||||
#define NS_CREATE (NS_WINDOW_START)
|
||||
// Widget is being destroyed
|
||||
#define NS_DESTROY (NS_WINDOW_START + 1)
|
||||
// Widget was resized
|
||||
#define NS_SIZE (NS_WINDOW_START + 2)
|
||||
// Widget gained focus
|
||||
#define NS_GOTFOCUS (NS_WINDOW_START + 3)
|
||||
// Widget lost focus
|
||||
#define NS_LOSTFOCUS (NS_WINDOW_START + 4)
|
||||
// Widget got activated
|
||||
#define NS_ACTIVATE (NS_WINDOW_START + 5)
|
||||
// Widget got deactivated
|
||||
#define NS_DEACTIVATE (NS_WINDOW_START + 6)
|
||||
// Widget needs to be repainted
|
||||
#define NS_PAINT (NS_WINDOW_START + 30)
|
||||
// Key is pressed within a window
|
||||
#define NS_KEY_PRESS (NS_WINDOW_START + 31)
|
||||
// Key is released within a window
|
||||
#define NS_KEY_UP (NS_WINDOW_START + 32)
|
||||
// Key is pressed within a window
|
||||
#define NS_KEY_DOWN (NS_WINDOW_START + 33)
|
||||
// Window has been moved to a new location.
|
||||
// The events point contains the x, y location in screen coordinates
|
||||
#define NS_MOVE (NS_WINDOW_START + 34)
|
||||
|
||||
// Tab control's selected tab has changed
|
||||
#define NS_TABCHANGE (NS_WINDOW_START + 35)
|
||||
|
||||
|
||||
|
||||
// Menu item selected
|
||||
#define NS_MENU_SELECTED (NS_WINDOW_START + 38)
|
||||
|
||||
// Form control changed: currently == combo box selection changed
|
||||
// but could be expanded to mean textbox, checkbox changed, etc.
|
||||
// This is a GUI specific event that does not necessarily correspond
|
||||
// directly to a mouse click or a key press.
|
||||
#define NS_CONTROL_CHANGE (NS_WINDOW_START + 39)
|
||||
|
||||
// Indicates the display has changed depth
|
||||
#define NS_DISPLAYCHANGED (NS_WINDOW_START + 40)
|
||||
|
||||
|
||||
#define NS_MOUSE_MESSAGE_START 300
|
||||
#define NS_MOUSE_MOVE (NS_MOUSE_MESSAGE_START)
|
||||
#define NS_MOUSE_LEFT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 1)
|
||||
#define NS_MOUSE_LEFT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 2)
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_UP (NS_MOUSE_MESSAGE_START + 10)
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 11)
|
||||
#define NS_MOUSE_RIGHT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 20)
|
||||
#define NS_MOUSE_RIGHT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 21)
|
||||
#define NS_MOUSE_ENTER (NS_MOUSE_MESSAGE_START + 22)
|
||||
#define NS_MOUSE_EXIT (NS_MOUSE_MESSAGE_START + 23)
|
||||
#define NS_MOUSE_LEFT_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 24)
|
||||
#define NS_MOUSE_MIDDLE_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 25)
|
||||
#define NS_MOUSE_RIGHT_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 26)
|
||||
#define NS_MOUSE_LEFT_CLICK (NS_MOUSE_MESSAGE_START + 27)
|
||||
#define NS_MOUSE_MIDDLE_CLICK (NS_MOUSE_MESSAGE_START + 28)
|
||||
#define NS_MOUSE_RIGHT_CLICK (NS_MOUSE_MESSAGE_START + 29)
|
||||
#define NS_MOUSE_ACTIVATE (NS_MOUSE_MESSAGE_START + 30)
|
||||
|
||||
#define NS_SCROLLBAR_MESSAGE_START 1000
|
||||
#define NS_SCROLLBAR_POS (NS_SCROLLBAR_MESSAGE_START)
|
||||
#define NS_SCROLLBAR_PAGE_NEXT (NS_SCROLLBAR_MESSAGE_START + 1)
|
||||
#define NS_SCROLLBAR_PAGE_PREV (NS_SCROLLBAR_MESSAGE_START + 2)
|
||||
#define NS_SCROLLBAR_LINE_NEXT (NS_SCROLLBAR_MESSAGE_START + 3)
|
||||
#define NS_SCROLLBAR_LINE_PREV (NS_SCROLLBAR_MESSAGE_START + 4)
|
||||
|
||||
#define NS_STREAM_EVENT_START 1100
|
||||
#define NS_PAGE_LOAD (NS_STREAM_EVENT_START)
|
||||
#define NS_PAGE_UNLOAD (NS_STREAM_EVENT_START + 1)
|
||||
#define NS_IMAGE_LOAD (NS_STREAM_EVENT_START + 2)
|
||||
#define NS_IMAGE_ABORT (NS_STREAM_EVENT_START + 3)
|
||||
#define NS_IMAGE_ERROR (NS_STREAM_EVENT_START + 4)
|
||||
|
||||
#define NS_FORM_EVENT_START 1200
|
||||
#define NS_FORM_SUBMIT (NS_FORM_EVENT_START)
|
||||
#define NS_FORM_RESET (NS_FORM_EVENT_START + 1)
|
||||
#define NS_FORM_CHANGE (NS_FORM_EVENT_START + 2)
|
||||
#define NS_FORM_SELECTED (NS_FORM_EVENT_START + 3)
|
||||
#define NS_FORM_INPUT (NS_FORM_EVENT_START + 4)
|
||||
|
||||
//Need separate focus/blur notifications for non-native widgets
|
||||
#define NS_FOCUS_EVENT_START 1300
|
||||
#define NS_FOCUS_CONTENT (NS_FOCUS_EVENT_START)
|
||||
#define NS_BLUR_CONTENT (NS_FOCUS_EVENT_START + 1)
|
||||
|
||||
|
||||
#define NS_DRAGDROP_EVENT_START 1400
|
||||
#define NS_DRAGDROP_ENTER (NS_DRAGDROP_EVENT_START)
|
||||
#define NS_DRAGDROP_OVER (NS_DRAGDROP_EVENT_START + 1)
|
||||
#define NS_DRAGDROP_EXIT (NS_DRAGDROP_EVENT_START + 2)
|
||||
#define NS_DRAGDROP_DROP (NS_DRAGDROP_EVENT_START + 3)
|
||||
#define NS_DRAGDROP_GESTURE (NS_DRAGDROP_EVENT_START + 4)
|
||||
|
||||
// Events for popups
|
||||
#define NS_MENU_EVENT_START 1500
|
||||
#define NS_MENU_CREATE (NS_MENU_EVENT_START)
|
||||
#define NS_MENU_DESTROY (NS_MENU_EVENT_START+1)
|
||||
#define NS_MENU_ACTION (NS_MENU_EVENT_START+2)
|
||||
#define NS_XUL_BROADCAST (NS_MENU_EVENT_START+3)
|
||||
#define NS_XUL_COMMAND_UPDATE (NS_MENU_EVENT_START+4)
|
||||
//@}
|
||||
|
||||
|
||||
#define NS_IS_MOUSE_EVENT(evnt) \
|
||||
(((evnt)->message == NS_MOUSE_LEFT_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_ENTER) || \
|
||||
((evnt)->message == NS_MOUSE_EXIT) || \
|
||||
((evnt)->message == NS_MOUSE_MOVE))
|
||||
|
||||
#define NS_IS_KEY_EVENT(evnt) \
|
||||
(((evnt)->message == NS_KEY_DOWN) || \
|
||||
((evnt)->message == NS_KEY_PRESS) || \
|
||||
((evnt)->message == NS_KEY_UP))
|
||||
|
||||
/*
|
||||
* Virtual key bindings for keyboard events
|
||||
* NOTE: These are repeated in nsIDOMEvent.h and must be kept in sync
|
||||
*/
|
||||
|
||||
#define NS_VK_CANCEL 0x03
|
||||
#define NS_VK_BACK 0x08
|
||||
#define NS_VK_TAB 0x09
|
||||
#define NS_VK_CLEAR 0x0C
|
||||
#define NS_VK_RETURN 0x0D
|
||||
#define NS_VK_ENTER 0x0E
|
||||
#define NS_VK_SHIFT 0x10
|
||||
#define NS_VK_CONTROL 0x11
|
||||
#define NS_VK_ALT 0x12
|
||||
#define NS_VK_PAUSE 0x13
|
||||
#define NS_VK_CAPS_LOCK 0x14
|
||||
#define NS_VK_ESCAPE 0x1B
|
||||
#define NS_VK_SPACE 0x20
|
||||
#define NS_VK_PAGE_UP 0x21
|
||||
#define NS_VK_PAGE_DOWN 0x22
|
||||
#define NS_VK_END 0x23
|
||||
#define NS_VK_HOME 0x24
|
||||
#define NS_VK_LEFT 0x25
|
||||
#define NS_VK_UP 0x26
|
||||
#define NS_VK_RIGHT 0x27
|
||||
#define NS_VK_DOWN 0x28
|
||||
#define NS_VK_PRINTSCREEN 0x2C
|
||||
#define NS_VK_INSERT 0x2D
|
||||
#define NS_VK_DELETE 0x2E
|
||||
|
||||
// NS_VK_0 - NS_VK_9 match their ascii values
|
||||
#define NS_VK_0 0x30
|
||||
#define NS_VK_1 0x31
|
||||
#define NS_VK_2 0x32
|
||||
#define NS_VK_3 0x33
|
||||
#define NS_VK_4 0x34
|
||||
#define NS_VK_5 0x35
|
||||
#define NS_VK_6 0x36
|
||||
#define NS_VK_7 0x37
|
||||
#define NS_VK_8 0x38
|
||||
#define NS_VK_9 0x39
|
||||
|
||||
#define NS_VK_SEMICOLON 0x3B
|
||||
#define NS_VK_EQUALS 0x3D
|
||||
|
||||
// NS_VK_A - NS_VK_Z match their ascii values
|
||||
#define NS_VK_A 0x41
|
||||
#define NS_VK_B 0x42
|
||||
#define NS_VK_C 0x43
|
||||
#define NS_VK_D 0x44
|
||||
#define NS_VK_E 0x45
|
||||
#define NS_VK_F 0x46
|
||||
#define NS_VK_G 0x47
|
||||
#define NS_VK_H 0x48
|
||||
#define NS_VK_I 0x49
|
||||
#define NS_VK_J 0x4A
|
||||
#define NS_VK_K 0x4B
|
||||
#define NS_VK_L 0x4C
|
||||
#define NS_VK_M 0x4D
|
||||
#define NS_VK_N 0x4E
|
||||
#define NS_VK_O 0x4F
|
||||
#define NS_VK_P 0x50
|
||||
#define NS_VK_Q 0x51
|
||||
#define NS_VK_R 0x52
|
||||
#define NS_VK_S 0x53
|
||||
#define NS_VK_T 0x54
|
||||
#define NS_VK_U 0x55
|
||||
#define NS_VK_V 0x56
|
||||
#define NS_VK_W 0x57
|
||||
#define NS_VK_X 0x58
|
||||
#define NS_VK_Y 0x59
|
||||
#define NS_VK_Z 0x5A
|
||||
|
||||
#define NS_VK_NUMPAD0 0x60
|
||||
#define NS_VK_NUMPAD1 0x61
|
||||
#define NS_VK_NUMPAD2 0x62
|
||||
#define NS_VK_NUMPAD3 0x63
|
||||
#define NS_VK_NUMPAD4 0x64
|
||||
#define NS_VK_NUMPAD5 0x65
|
||||
#define NS_VK_NUMPAD6 0x66
|
||||
#define NS_VK_NUMPAD7 0x67
|
||||
#define NS_VK_NUMPAD8 0x68
|
||||
#define NS_VK_NUMPAD9 0x69
|
||||
#define NS_VK_MULTIPLY 0x6A
|
||||
#define NS_VK_ADD 0x6B
|
||||
#define NS_VK_SEPARATOR 0x6C
|
||||
#define NS_VK_SUBTRACT 0x6D
|
||||
#define NS_VK_DECIMAL 0x6E
|
||||
#define NS_VK_DIVIDE 0x6F
|
||||
#define NS_VK_F1 0x70
|
||||
#define NS_VK_F2 0x71
|
||||
#define NS_VK_F3 0x72
|
||||
#define NS_VK_F4 0x73
|
||||
#define NS_VK_F5 0x74
|
||||
#define NS_VK_F6 0x75
|
||||
#define NS_VK_F7 0x76
|
||||
#define NS_VK_F8 0x77
|
||||
#define NS_VK_F9 0x78
|
||||
#define NS_VK_F10 0x79
|
||||
#define NS_VK_F11 0x7A
|
||||
#define NS_VK_F12 0x7B
|
||||
#define NS_VK_F13 0x7C
|
||||
#define NS_VK_F14 0x7D
|
||||
#define NS_VK_F15 0x7E
|
||||
#define NS_VK_F16 0x7F
|
||||
#define NS_VK_F17 0x80
|
||||
#define NS_VK_F18 0x81
|
||||
#define NS_VK_F19 0x82
|
||||
#define NS_VK_F20 0x83
|
||||
#define NS_VK_F21 0x84
|
||||
#define NS_VK_F22 0x85
|
||||
#define NS_VK_F23 0x86
|
||||
#define NS_VK_F24 0x87
|
||||
|
||||
#define NS_VK_NUM_LOCK 0x90
|
||||
#define NS_VK_SCROLL_LOCK 0x91
|
||||
|
||||
#define NS_VK_COMMA 0xBC
|
||||
#define NS_VK_PERIOD 0xBE
|
||||
#define NS_VK_SLASH 0xBF
|
||||
#define NS_VK_BACK_QUOTE 0xC0
|
||||
#define NS_VK_OPEN_BRACKET 0xDB
|
||||
#define NS_VK_BACK_SLASH 0xDC
|
||||
#define NS_VK_CLOSE_BRACKET 0xDD
|
||||
#define NS_VK_QUOTE 0xDE
|
||||
|
||||
#define NS_EVENT_FLAG_NONE 0x0000
|
||||
#define NS_EVENT_FLAG_INIT 0x0001
|
||||
#define NS_EVENT_FLAG_BUBBLE 0x0002
|
||||
#define NS_EVENT_FLAG_CAPTURE 0x0004
|
||||
#define NS_EVENT_FLAG_STOP_DISPATCH 0x0008
|
||||
#define NS_EVENT_FLAG_NO_DEFAULT 0x0010
|
||||
|
||||
// IME Constants -- keep in synch with nsIDOMTextRange.h
|
||||
#define NS_TEXTRANGE_CARETPOSITION 0x01
|
||||
#define NS_TEXTRANGE_RAWINPUT 0X02
|
||||
#define NS_TEXTRANGE_SELECTEDRAWTEXT 0x03
|
||||
#define NS_TEXTRANGE_CONVERTEDTEXT 0x04
|
||||
#define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
|
||||
|
||||
#endif // nsGUIEvent_h__
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
native int(int);
|
||||
[ptr] native nsDispatchListener(nsDispatchListener);
|
||||
[ptr] native nsIEventQueue(nsIEventQueue);
|
||||
[ptr] native UndefinednsIWidget(nsIWidget);
|
||||
[ref] native PRBoolRef(PRBool);
|
||||
[ref] native voidStarRef(void *);
|
||||
|
||||
%{ C++
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
/**
|
||||
* Flags for the getNativeData function.
|
||||
* See GetNativeData()
|
||||
*/
|
||||
#define NS_NATIVE_SHELL 0
|
||||
|
||||
/**
|
||||
* During the nsIAppShell Run method notify this listener
|
||||
* after each message dispatch.
|
||||
* @see SetDispatchListener member function of nsIAppShell
|
||||
*/
|
||||
class nsDispatchListener {
|
||||
public:
|
||||
virtual void AfterDispatch() = 0;
|
||||
};
|
||||
|
||||
class nsIWidget;
|
||||
%}
|
||||
|
||||
|
||||
[uuid(a0757c31-eeac-11d1-9ec1-00aa002fb821)]
|
||||
interface nsIAppShell : nsISupports
|
||||
{
|
||||
/**
|
||||
* Creates an application shell
|
||||
*/
|
||||
|
||||
void Create(inout int argc, inout string argv);
|
||||
|
||||
/**
|
||||
* Enter an event loop.
|
||||
* Don't leave until application exits.
|
||||
*/
|
||||
|
||||
void Run();
|
||||
|
||||
/**
|
||||
* Prepare to process events.
|
||||
*/
|
||||
|
||||
void Spinup();
|
||||
|
||||
/**
|
||||
* Prepare to stop processing events.
|
||||
*/
|
||||
|
||||
void Spindown();
|
||||
|
||||
/**
|
||||
* An event queue has been created or destroyed. Hook or unhook it from
|
||||
* your system, as necessary.
|
||||
* @param aQueue the queue in question
|
||||
* @param aListen PR_TRUE for a new queue wanting hooking up. PR_FALSE
|
||||
* for a queue wanting to be unhooked.
|
||||
*/
|
||||
void ListenToEventQueue(in nsIEventQueue aQueue, in PRBool aListen);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void GetNativeEvent(in PRBoolRef aRealEvent, in voidStarRef aEvent);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void DispatchNativeEvent(in PRBool aRealEvent, in voidStar aEvent);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void SetDispatchListener(in nsDispatchListener aDispatchListener);
|
||||
|
||||
/**
|
||||
* Exit the handle event loop
|
||||
*/
|
||||
|
||||
void Exit();
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIAppShell_h__
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIButton_h__
|
||||
#define nsIButton_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {18032AD0-B265-11d1-AA2A-000000000000}
|
||||
#define NS_IBUTTON_IID \
|
||||
{ 0x18032ad0, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
/**
|
||||
* Push button widget.
|
||||
* Automatically shows itself as depressed when clicked on.
|
||||
*/
|
||||
class nsIButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the label
|
||||
*
|
||||
* @param Set the label to aText
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,81 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsICheckButton_h__
|
||||
#define nsICheckButton_h__
|
||||
|
||||
// {961085F5-BD28-11d1-97EF-00609703C14E}
|
||||
#define NS_ICHECKBUTTON_IID \
|
||||
{ 0x961085f5, 0xbd28, 0x11d1, { 0x97, 0xef, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
||||
/**
|
||||
* Checkbox widget.
|
||||
* Can show itself in a checked or unchecked state.
|
||||
* The checkbox widget does not automatically show itself checked or unchecked when clicked on.
|
||||
*/
|
||||
class nsICheckButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHECKBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the button label
|
||||
*
|
||||
* @param aText button label
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Set the check state.
|
||||
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetState(const PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Get the check state.
|
||||
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetState(PRBool& aState) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsICheckButton_h__
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsITransferable.idl"
|
||||
#include "nsIClipboardOwner.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BA-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsIClipboard : nsISupports
|
||||
{
|
||||
/**
|
||||
* Given a transferable, set the data on the native clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @param anOwner The owner of the transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void setData ( in nsITransferable aTransferable, in nsIClipboardOwner anOwner) ;
|
||||
|
||||
/**
|
||||
* Given a transferable, get the clipboard data.
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void getData ( in nsITransferable aTransferable ) ;
|
||||
|
||||
/**
|
||||
* This empties the clipboard and notifies the clipboard owner.
|
||||
* This empties the "logical" clipboard. It does not clear the native clipboard.
|
||||
*
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
|
||||
void emptyClipboard ( ) ;
|
||||
|
||||
/**
|
||||
* Some platforms support deferred notification for putting data on the clipboard
|
||||
* This method forces the data onto the clipboard in its various formats
|
||||
* This may be used if the application going away.
|
||||
*
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
|
||||
void forceDataToClipboard ( ) ;
|
||||
|
||||
/**
|
||||
* This provides a way to give correct UI feedback about, for instance, a paste
|
||||
* should be allowed. It does _NOT_ actually retreive the data and should be a very
|
||||
* inexpensive call. All it does is check if there is data on the clipboard matching
|
||||
* any of the flavors in the given list.
|
||||
*
|
||||
* @aFlavorList - nsISupportsString's in a nsISupportsArray (for JavaScript).
|
||||
* @outResult - if data is present matching one of
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
boolean hasDataMatchingFlavors ( in nsISupportsArray aFlavorList ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
@@ -1,45 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsITransferable.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(5A31C7A1-E122-11d2-9A57-000064657374)]
|
||||
interface nsIClipboardOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the owner of the clipboard transferable that the
|
||||
* transferable is being removed from the clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void LosingOwnership ( in nsITransferable aTransferable ) ;
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
@@ -1,141 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIComboBox_h__
|
||||
#define nsIComboBox_h__
|
||||
|
||||
#include "nsIListWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {961085F6-BD28-11d1-97EF-00609703C14E}
|
||||
#define NS_ICOMBOBOX_IID \
|
||||
{ 0x961085f6, 0xbd28, 0x11d1, { 0x97, 0xef, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Initialize combobox data
|
||||
*/
|
||||
|
||||
struct nsComboBoxInitData : public nsWidgetInitData {
|
||||
nsComboBoxInitData()
|
||||
: mDropDownHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
PRUint32 mDropDownHeight; // in pixels
|
||||
};
|
||||
|
||||
/**
|
||||
* Single selection drop down list. See nsIListWidget for capabilities
|
||||
*/
|
||||
|
||||
class nsIComboBox : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMBOBOX_IID);
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsIComboBox_h__
|
||||
|
||||
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIContextMenu_h__
|
||||
#define nsIContextMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenu;
|
||||
class nsIMenuItem;
|
||||
class nsIMenuListener;
|
||||
|
||||
//Generate this!
|
||||
// {35A3DEC1-4992-11d2-8DBA-00609703C14E}
|
||||
#define NS_ICONTEXTMENU_IID \
|
||||
{ 0x35a3dec1, 0x4992, 0x11d2, \
|
||||
{ 0x8d, 0xba, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Menu widget
|
||||
*/
|
||||
class nsIContextMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTEXTMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the context menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString& anAlignment, const nsString& anAnchorAlignment) = 0;
|
||||
|
||||
/**
|
||||
* Get the context menu's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds a context menu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsISupports* aItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of context menu items
|
||||
* This does count separators as items
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu or Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void** aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Set location
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLocation(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement) = 0;
|
||||
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsIDragSession.idl"
|
||||
#include "nsIScriptableRegion.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BB-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsIDragService : nsISupports
|
||||
{
|
||||
const long DRAGDROP_ACTION_NONE = 0;
|
||||
const long DRAGDROP_ACTION_COPY = 1;
|
||||
const long DRAGDROP_ACTION_MOVE = 2;
|
||||
const long DRAGDROP_ACTION_LINK = 4;
|
||||
|
||||
/**
|
||||
* Starts a modal drag session with an array of transaferables
|
||||
*
|
||||
* @param aTransferables - an array of transferables to be dragged
|
||||
* @param aRegion - a region containing rectangles for cursor feedback,
|
||||
* in window coordinates.
|
||||
* @param aActionType - specified which of copy/move/link are allowed
|
||||
*/
|
||||
void invokeDragSession ( in nsISupportsArray aTransferables,
|
||||
in nsIScriptableRegion aRegion, in unsigned long aActionType );
|
||||
|
||||
/**
|
||||
* Returns the current Drag Session
|
||||
*/
|
||||
nsIDragSession getCurrentSession ( ) ;
|
||||
|
||||
/**
|
||||
* Tells the Drag Service to start a drag session. This is called when
|
||||
* an external drag occurs
|
||||
*/
|
||||
void startDragSession ( ) ;
|
||||
|
||||
/**
|
||||
* Tells the Drag Service to end a drag session. This is called when
|
||||
* an external drag occurs
|
||||
*/
|
||||
void endDragSession ( ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
@@ -1,80 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsITransferable.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsSize.h"
|
||||
%}
|
||||
|
||||
native nsSize (nsSize);
|
||||
|
||||
|
||||
[scriptable, uuid(CBA22C53-FCCE-11d2-96D4-0060B0FB9956)]
|
||||
interface nsIDragSession : nsISupports
|
||||
{
|
||||
/**
|
||||
* Set the current state of the drag whether it can be dropped or not.
|
||||
* usually the target "frame" sets this so the native system can render the correct feedback
|
||||
*/
|
||||
attribute boolean canDrop;
|
||||
|
||||
/**
|
||||
* Sets the action (copy, move, link, et.c) for the current drag
|
||||
*/
|
||||
attribute unsigned long dragAction;
|
||||
|
||||
/**
|
||||
* Sets the current width and height if the drag target area.
|
||||
* It will contain the current size of the Frame that the drag is currently in
|
||||
*/
|
||||
attribute nsSize targetSize;
|
||||
|
||||
/**
|
||||
* Get the number items that were dropped
|
||||
*/
|
||||
readonly attribute unsigned long numDropItems;
|
||||
|
||||
/**
|
||||
* Get data from a Drag&Drop. Can be called while the drag is in process
|
||||
* or after the drop has completed.
|
||||
*
|
||||
* @param aTransferable the transferable for the data to be put into
|
||||
* @param aItemIndex which of multiple drag items, zero-based
|
||||
*/
|
||||
void getData ( in nsITransferable aTransferable, in unsigned long aItemIndex ) ;
|
||||
|
||||
/**
|
||||
* Check to set if ant of the native data on the clipboard matches this data flavor
|
||||
*
|
||||
* @result NS_OK if if the data flavor is supported and, NS_ERROR_FAILURE is it is not
|
||||
*/
|
||||
boolean isDataFlavorSupported ( in string aDataFlavor ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIDragSessionMac_h__
|
||||
#define nsIDragSessionMac_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include <Drag.h>
|
||||
|
||||
|
||||
#define NS_IDRAGSESSIONMAC_IID \
|
||||
{ 0x36c4c380, 0x09e2, 0x11d3, { 0xb0, 0x33, 0xa4, 0x20, 0xf4, 0x2c, 0xfd, 0x7c } };
|
||||
|
||||
|
||||
class nsIDragSessionMac : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDRAGSESSIONMAC_IID)
|
||||
|
||||
/**
|
||||
* Since the drag may originate in an external application, we need some way of
|
||||
* communicating the DragManager's DragRef to the session so it can use it
|
||||
* when filling in data requests.
|
||||
*
|
||||
* @param aDragRef the MacOS DragManager's ref number for the current drag
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetDragReference ( DragReference aDragRef ) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,52 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIEventListener_h__
|
||||
#define nsIEventListener_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
/**
|
||||
* Event listener interface.
|
||||
* Alternative to a callback for recieving events.
|
||||
*/
|
||||
|
||||
// {c83f6b80-d7ce-11d2-8360-c4c894c4917c}
|
||||
#define NS_IEVENTLISTENER_IID \
|
||||
{ 0xc83f6b80, 0xd7ce, 0x11d2, { 0x83, 0x60, 0xc4, 0xc8, 0x94, 0xc4, 0x91, 0x7c } }
|
||||
|
||||
class nsIEventListener : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IEVENTLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes all events.
|
||||
* If a mouse listener is registered this method will not process mouse events.
|
||||
* @param anEvent the event to process. See nsGUIEvent.h for event types.
|
||||
*/
|
||||
|
||||
virtual nsEventStatus ProcessEvent(const nsGUIEvent & anEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIEventListener_h__
|
||||
@@ -1,75 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFileDialogsMgr_h__
|
||||
#define nsIFileDialogsMgr_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
// {0ef98781-e34b-11d2-b345-00a0cc3c1cde}
|
||||
#define NS_IFILEDIALOGSMGR_IID \
|
||||
{ 0xef98781, 0xe34b, 0x11d2, { 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
#define NS_FILEDIALOGSMGR_CID \
|
||||
{ 0xef98784, 0xe34b, 0x11d2, { 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
enum nsFileDlgResults {
|
||||
nsFileDlgResults_Cancel, // User hit cancel, ignore selection
|
||||
nsFileDlgResults_OK, // User hit Ok, process selection
|
||||
nsFileDlgResults_Replace // User acknowledged file already exists so ok to replace, process selection
|
||||
};
|
||||
|
||||
/**
|
||||
* (native) File Dialogs utility.
|
||||
* Provides an XP wrapper to platform native file dialogs:
|
||||
* GetFile - Presents a file browser and returns an nsFileSpec for the selected file
|
||||
* GetFolder - Presents a folder/path selection dialog and returns an nsFileSpec
|
||||
* PutFile - Presents a file save dialog to the user and returns an nsFileSpec with
|
||||
* the name and path to save the file
|
||||
*
|
||||
*/
|
||||
|
||||
class nsIFileDialogsMgr : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILEDIALOGSMGR_IID)
|
||||
|
||||
NS_IMETHOD GetFile(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the file selection dialog prompt
|
||||
const nsString * promptString, // Window title for file selection dialog
|
||||
void * filterList) = 0;
|
||||
|
||||
NS_IMETHOD GetFolder(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the folder selection dialog prompt
|
||||
const nsString * promptString) = 0; // Window title for folder selection dialog
|
||||
|
||||
NS_IMETHOD PutFile(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the file save dialog prompt
|
||||
const nsString * promptString) = 0; // Window title for file save dialog
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIFileDialogsMgr_h__
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[scriptable, uuid(c47de916-1dd1-11b2-8141-82507fa02b21)]
|
||||
interface nsIFilePicker : nsISupports
|
||||
{
|
||||
const short modeLoad = 0; // Load a file or directory
|
||||
const short modeSave = 1; // Save a file or directory
|
||||
const short modeGetFolder = 2; // Select a fodler/directory
|
||||
|
||||
const short returnOK = 0; // User hit cancel, ignore selection
|
||||
const short returnCancel = 1; // User hit Ok, process selection
|
||||
const short returnReplace = 2; // User acknowledged file already exists so ok to replace, process selection
|
||||
|
||||
/**
|
||||
* Create the file widget.
|
||||
*
|
||||
* @param parent nsIDOMWindow parent. This dialog should be dependant on this parent.
|
||||
* @param title The title for the file widget
|
||||
* @param mode load, save, or get folder
|
||||
*
|
||||
*/
|
||||
void create(in nsIDOMWindow parent, in wstring title, in short mode);
|
||||
|
||||
/**
|
||||
* Set the list of file filters
|
||||
*
|
||||
* @param titles array of filter titles
|
||||
* @param filters array of filters to associate with titles
|
||||
* @param numberOfFilters number of filters.
|
||||
*
|
||||
*/
|
||||
void setFilterList(in long numberOfFilters,
|
||||
[array, size_is(numberOfFilters)] in wstring titles,
|
||||
[array, size_is(numberOfFilters)] in wstring filters);
|
||||
|
||||
/**
|
||||
* Get the index into the filter list for the type of file the user wants to save
|
||||
*
|
||||
* @param selectedFilter the index of the selected item in the filter list
|
||||
*
|
||||
*/
|
||||
readonly attribute long selectedFilter;
|
||||
|
||||
/* what is this? */
|
||||
attribute wstring defaultString;
|
||||
|
||||
/**
|
||||
* Set the directory that the file open/save dialog initially displays
|
||||
*
|
||||
* @param displayDirectory the name of the directory
|
||||
*
|
||||
*/
|
||||
attribute nsIFileSpec displayDirectory;
|
||||
|
||||
|
||||
/**
|
||||
* Get the nsFileSpec for the file or directory.
|
||||
*
|
||||
* @return Returns the file currently selected
|
||||
*/
|
||||
readonly attribute nsIFileSpec file;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
*
|
||||
* @return returnOK if the user selects OK, returnCancel if the user selects cancel
|
||||
*
|
||||
*/
|
||||
short show();
|
||||
};
|
||||
@@ -1,112 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// This is the only correct cross-platform way to specify a file.
|
||||
// Strings are not such a way. If you grew up on windows or unix, you
|
||||
// may think they are. Welcome to reality.
|
||||
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
%{C++
|
||||
#include "nscore.h" // for NS_WIDGET
|
||||
#include "nsIComponentManager.h"
|
||||
%}
|
||||
native StandardFilterMask(nsIFileSpecWithUI::StandardFilterMask);
|
||||
|
||||
[scriptable, uuid(8ddf7681-139a-11d3-915f-dc1f8c138b7c)]
|
||||
interface nsIFileSpecWithUI : nsIFileSpec
|
||||
{
|
||||
%{C++
|
||||
//
|
||||
// The "choose" functions present the file picker UI in order to set the
|
||||
// value of the file spec.
|
||||
%}
|
||||
|
||||
%{C++
|
||||
// The mask for standard filters is given as follows:
|
||||
enum StandardFilterMask
|
||||
{
|
||||
eAllReadable = (1<<0)
|
||||
, eHTMLFiles = (1<<1)
|
||||
, eXMLFiles = (1<<2)
|
||||
, eImageFiles = (1<<3)
|
||||
, eMailFiles = (1<<4)
|
||||
, eTextFiles = (1<<5)
|
||||
, eAllFiles = (1<<6)
|
||||
|
||||
// Mask containing all the above default filters
|
||||
, eAllStandardFilters = (
|
||||
eAllReadable
|
||||
| eHTMLFiles
|
||||
| eXMLFiles
|
||||
| eImageFiles
|
||||
| eMailFiles
|
||||
| eTextFiles
|
||||
| eAllFiles)
|
||||
, eAllMailOutputFilters = (
|
||||
eHTMLFiles
|
||||
| eMailFiles
|
||||
| eTextFiles)
|
||||
|
||||
// The "extra filter" bit should be set if the "extra filter"
|
||||
// is passed in to chooseInputFile.
|
||||
, eExtraFilter = (1<<31)
|
||||
};
|
||||
enum { kNumStandardFilters = 7, kNumMailFilters = 3 };
|
||||
%}
|
||||
[noscript] void chooseInputFile(
|
||||
in string title
|
||||
, in StandardFilterMask standardFilterMask
|
||||
, in string extraFilterTitle
|
||||
, in string extraFilter
|
||||
);
|
||||
|
||||
[noscript] void chooseOutputFile(in string windowTitle,
|
||||
in string suggestedLeafName,
|
||||
in StandardFilterMask standardFilterMask);
|
||||
|
||||
string chooseFile(in string title);
|
||||
string chooseDirectory(in string title);
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Define Progid and CID
|
||||
// {e3326a80-2816-11d3-a7e5-98cb48c74f3c}
|
||||
#define NS_FILESPECWITHUI_CID \
|
||||
{ 0xe3326a80, 0x2816, 0x11d3, { 0xa7, 0xe5, 0x98, 0xcb, 0x48, 0xc7, 0x4f, 0x3c } }
|
||||
|
||||
#define NS_FILESPECWITHUI_PROGID "component://netscape/filespecwithui"
|
||||
#define NS_FILESPECWITHUI_CLASSNAME "nsIFileSpecWithUI"
|
||||
|
||||
// Factory methods
|
||||
inline nsIFileSpecWithUI* NS_CreateFileSpecWithUI()
|
||||
{
|
||||
nsIFileSpecWithUI* spec = nsnull;
|
||||
nsresult rv = nsComponentManager::CreateInstance(
|
||||
(const char*)NS_FILESPECWITHUI_PROGID,
|
||||
(nsISupports*)nsnull,
|
||||
(const nsID&)nsIFileSpecWithUI::GetIID(),
|
||||
(void**)&spec);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Could not make a file spec.");
|
||||
return spec;
|
||||
}
|
||||
%}
|
||||
@@ -1,178 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFileWidget_h__
|
||||
#define nsIFileWidget_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
class nsIWidget;
|
||||
class nsIDeviceContext;
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
|
||||
// {F8030015-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_IFILEWIDGET_IID \
|
||||
{ 0xf8030015, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* File selector mode
|
||||
*/
|
||||
|
||||
enum nsFileDlgMode {
|
||||
/// Load a file or directory
|
||||
eMode_load,
|
||||
/// Save a file or directory
|
||||
eMode_save,
|
||||
/// Select a fodler/directory
|
||||
eMode_getfolder
|
||||
};
|
||||
|
||||
|
||||
enum nsFileDlgResults {
|
||||
nsFileDlgResults_Cancel, // User hit cancel, ignore selection
|
||||
nsFileDlgResults_OK, // User hit Ok, process selection
|
||||
nsFileDlgResults_Replace // User acknowledged file already exists so ok to replace, process selection
|
||||
};
|
||||
|
||||
/**
|
||||
* File selector widget.
|
||||
* Modally selects files for loading or saving from a list.
|
||||
*/
|
||||
|
||||
class nsIFileWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILEWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Create the file filter. This differs from the standard
|
||||
* widget Create method because it passes in the mode
|
||||
*
|
||||
* @param aParent the parent to place this widget into
|
||||
* @param aTitle The title for the file widget
|
||||
* @param aMode load or save
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
void *aInitData = nsnull) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the list of file filters
|
||||
*
|
||||
* @param aNumberOfFilter number of filters.
|
||||
* @param aTitle array of filter titles
|
||||
* @param aFilter array of filters to associate with titles
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[]) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the index into the filter list for the type of file the user wants to save
|
||||
*
|
||||
* @param theType the index into the filter list
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelectedType(PRInt16& theType) = 0;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
*
|
||||
* @return PR_TRUE if user selects OK, PR_FALSE if user selects CANCEL
|
||||
*
|
||||
*/
|
||||
|
||||
virtual PRBool Show() = 0;
|
||||
|
||||
/**
|
||||
* Get the nsFileSpec for the file or directory.
|
||||
*
|
||||
* @param aFile on exit it contains the file or directory selected
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the default string that appears in file open/save dialog
|
||||
*
|
||||
* @param aString the name of the file
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDefaultString(const nsString& aString) = 0;
|
||||
|
||||
/**
|
||||
* Set the directory that the file open/save dialog initially displays
|
||||
*
|
||||
* @param aDirectory the name of the directory
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDisplayDirectory(const nsFileSpec& aDirectory) = 0;
|
||||
|
||||
/**
|
||||
* Get the directory that the file open/save dialog was last displaying
|
||||
*
|
||||
* @param aDirectory the name of the directory
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetDisplayDirectory(nsFileSpec& aDirectory) = 0;
|
||||
|
||||
|
||||
virtual nsFileDlgResults GetFile(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
virtual nsFileDlgResults GetFolder(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
virtual nsFileDlgResults PutFile(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIFileWidget_h__
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFontNameIterator_h__
|
||||
#define nsIFontNameIterator_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsString;
|
||||
|
||||
// {CEEB39D1-0949-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTNAMEITERATOR_IID \
|
||||
{ 0xceeb39d1, 0x949, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontNameIterator : public nsISupports
|
||||
// Fonts are identified by strings, |Get| and |Advance| are distinct to facility wrapping
|
||||
// with C++ objects as standard iterators.
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTNAMEITERATOR_IID)
|
||||
|
||||
NS_IMETHOD Reset() = 0;
|
||||
// does not need to be called initially, returns iterator to initial state
|
||||
|
||||
NS_IMETHOD Get( nsString* aFontName ) = 0;
|
||||
// returns an error when no more names are available
|
||||
|
||||
NS_IMETHOD Advance() = 0;
|
||||
// returns an error when no more names are available
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFontRetrieverService_h__
|
||||
#define nsIFontRetrieverService_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIFontNameIterator;
|
||||
class nsIFontSizeIterator;
|
||||
class nsString;
|
||||
|
||||
// {285EF9B2-094A-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTRETRIEVERSERVICE_IID \
|
||||
{ 0x285ef9b2, 0x94a, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontRetrieverService : public nsISupports
|
||||
// This (singleton) service exists soley as a factory to manufacture iterators
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTRETRIEVERSERVICE_IID)
|
||||
|
||||
NS_IMETHOD CreateFontNameIterator( nsIFontNameIterator** aIterator ) = 0;
|
||||
|
||||
NS_IMETHOD CreateFontSizeIterator( const nsString &aFontName, nsIFontSizeIterator** aIterator ) = 0;
|
||||
|
||||
NS_IMETHOD IsFontScalable( const nsString &aFontName, PRBool* aResult ) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFontSizeIterator_h__
|
||||
#define nsIFontSizeIterator_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsString;
|
||||
|
||||
// {285EF9B1-094A-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTSIZEITERATOR_IID \
|
||||
{ 0x285ef9b1, 0x94a, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontSizeIterator : public nsISupports
|
||||
// Font sizes are identified with doubles (e.g., for the possibility of fractional sizes from MM, etc.).
|
||||
// |Get| and |Advance| are distinct to facility wrapping with C++ objects as standard iterators.
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTSIZEITERATOR_IID)
|
||||
|
||||
NS_IMETHOD Reset() = 0;
|
||||
// does not need to be called initially, returns iterator to initial state
|
||||
|
||||
NS_IMETHOD Get( double* aFontSize ) = 0;
|
||||
// returns an error when no more sizes are available
|
||||
|
||||
NS_IMETHOD Advance() = 0;
|
||||
// returns an error when no more sizes are available
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(948A0023-E3A7-11d2-96CF-0060B0FB9956)]
|
||||
interface nsIFormatConverter : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the list of the "input" data flavors (mime types as nsISupportsString),
|
||||
* in otherwords, the flavors that this converter can convert "from" (the
|
||||
* incoming data to the converter).
|
||||
*/
|
||||
nsISupportsArray getInputDataFlavors ( ) ;
|
||||
|
||||
/**
|
||||
* Get the list of the "output" data flavors (mime types as nsISupportsString),
|
||||
* in otherwords, the flavors that this converter can convert "to" (the
|
||||
* outgoing data to the converter).
|
||||
*
|
||||
* @param aDataFlavorList fills list with supported flavors
|
||||
*/
|
||||
nsISupportsArray getOutputDataFlavors ( ) ;
|
||||
|
||||
/**
|
||||
* Determines whether a converion from one flavor to another is supported
|
||||
*
|
||||
* @param aFromFormatConverter flavor to convert from
|
||||
* @param aFromFormatConverter flavor to convert to
|
||||
*/
|
||||
boolean canConvert ( in string aFromDataFlavor, in string aToDataFlavor ) ;
|
||||
|
||||
/**
|
||||
* Converts from one flavor to another.
|
||||
*
|
||||
* @param aFromFormatConverter flavor to convert from
|
||||
* @param aFromFormatConverter flavor to convert to (destination own the memory)
|
||||
* @returns returns NS_OK if it was converted
|
||||
*/
|
||||
void convert ( in string aFromDataFlavor, in nsISupports aFromData, in unsigned long aDataLen,
|
||||
in string aToDataFlavor, out nsISupports aToData, out unsigned long aDataToLen ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
@@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIKeyBindMgr_h__
|
||||
#define nsIKeyBindMgr_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
// {a91c0821-de58-11d2-b345-00a0cc3c1cde}
|
||||
#define NS_IKEYBINDMGR_IID \
|
||||
{ 0xa91c0821, 0xde58, 0x11d2, \
|
||||
{ 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
// {8B5314BD-DB01-11d2-96CE-0060B0FB9977}
|
||||
#define NS_KEYBINDMGR_CID \
|
||||
{ 0x8b5314bd, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x77 } }
|
||||
|
||||
/**
|
||||
* Keyboard Binding utility.
|
||||
* Given a key event and a DOM node to search executes any 'key' command
|
||||
* that matches the event
|
||||
*/
|
||||
|
||||
class nsIKeyBindMgr : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IKEYBINDMGR_IID)
|
||||
|
||||
NS_IMETHOD ProcessKeyEvent(
|
||||
nsIDOMDocument * domDoc,
|
||||
const nsKeyEvent & theEvent,
|
||||
nsIWebShell * webShell,
|
||||
nsEventStatus & theStatus) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIKeyBindMgr_h__
|
||||
@@ -1,91 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsILabel_h__
|
||||
#define nsILabel_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/* F3131891-3DC7-11d2-8DB8-00609703C14E */
|
||||
#define NS_ILABEL_IID \
|
||||
{ 0xf3131891, 0x3dc7, 0x11d2, \
|
||||
{ 0x8d, 0xb8, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Label Alignments
|
||||
*/
|
||||
|
||||
enum nsLabelAlignment {
|
||||
eAlign_Right,
|
||||
eAlign_Left,
|
||||
eAlign_Center
|
||||
};
|
||||
|
||||
struct nsLabelInitData : public nsWidgetInitData {
|
||||
nsLabelInitData()
|
||||
: mAlignment(eAlign_Left)
|
||||
{
|
||||
}
|
||||
|
||||
nsLabelAlignment mAlignment;
|
||||
};
|
||||
|
||||
/**
|
||||
* Label widget.
|
||||
* Automatically shows itself as depressed when clicked on.
|
||||
*/
|
||||
class nsILabel : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILABEL_IID)
|
||||
|
||||
/**
|
||||
* Set the label
|
||||
*
|
||||
* @param Set the label to aText
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the Label Alignemnt for creation
|
||||
*
|
||||
* @param aAlignment the alignment
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetAlignment(nsLabelAlignment aAlignment) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,183 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIListBox_h__
|
||||
#define nsIListBox_h__
|
||||
|
||||
#include "nsIListWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030014-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ILISTBOX_IID \
|
||||
{ 0xf8030014, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list box data
|
||||
*/
|
||||
|
||||
struct nsListBoxInitData : public nsWidgetInitData {
|
||||
nsListBoxInitData()
|
||||
: mMultiSelect(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool mMultiSelect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Single or multi selection list of items.
|
||||
* Unlike a nsIWidget, The the list widget must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
* The listbox always has a vertical scrollbar. It never has a
|
||||
* horizontal scrollbar.
|
||||
*/
|
||||
|
||||
class nsIListBox : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILISTBOX_IID)
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the listbox to be multi-select.
|
||||
* @param aMultiple PR_TRUE can have multiple selections. PR_FALSE single
|
||||
* selections only.
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections) = 0;
|
||||
|
||||
/**
|
||||
* Return the number of selected items. For single selection list box this
|
||||
* @return the number of selected items
|
||||
* can be 1 or 0.
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedCount() = 0;
|
||||
|
||||
/**
|
||||
* Retrieves the indices of the selected items.
|
||||
* @param aIndices Array to hold the selected items. Use GetSelectedCount to
|
||||
* determine how large the array needs to be.
|
||||
* @param aSize Size of the aIndices array
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Sets the indices of the selected items.
|
||||
* @param aIndices Array to hold the selected items. Use GetSelectedCount to
|
||||
* determine how large the array needs to be.
|
||||
* @param aSize Size of the aIndices array
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIListBox_h__
|
||||
|
||||
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIListWidget_h__
|
||||
#define nsIListWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030013-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ILISTWIDGET_IID \
|
||||
{ 0xf8030013, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
*
|
||||
* Base class for nsIListBox and nsIComboBox
|
||||
*
|
||||
*/
|
||||
|
||||
class nsIListWidget : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILISTWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIListWidget_h__
|
||||
|
||||
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsILookAndFeel
|
||||
#define __nsILookAndFeel
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#include "nsSize.h"
|
||||
#endif
|
||||
|
||||
|
||||
// {21B51DE1-21A3-11d2-B6E0-00805F8A2676}
|
||||
#define NS_ILOOKANDFEEL_IID \
|
||||
{ 0x21b51de1, 0x21a3, 0x11d2, \
|
||||
{ 0xb6, 0xe0, 0x0, 0x80, 0x5f, 0x8a, 0x26, 0x76 } }
|
||||
|
||||
class nsILookAndFeel: public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILOOKANDFEEL_IID)
|
||||
|
||||
typedef enum {
|
||||
eColor_WindowBackground,
|
||||
eColor_WindowForeground,
|
||||
eColor_WidgetBackground,
|
||||
eColor_WidgetForeground,
|
||||
eColor_WidgetSelectBackground,
|
||||
eColor_WidgetSelectForeground,
|
||||
eColor_Widget3DHighlight,
|
||||
eColor_Widget3DShadow,
|
||||
eColor_TextBackground,
|
||||
eColor_TextForeground,
|
||||
eColor_TextSelectBackground,
|
||||
eColor_TextSelectForeground,
|
||||
|
||||
// New CSS 2 color definitions
|
||||
eColor_activeborder,
|
||||
eColor_activecaption,
|
||||
eColor_appworkspace,
|
||||
eColor_background,
|
||||
eColor_buttonface,
|
||||
eColor_buttonhighlight,
|
||||
eColor_buttonshadow,
|
||||
eColor_buttontext,
|
||||
eColor_captiontext,
|
||||
eColor_graytext,
|
||||
eColor_highlight,
|
||||
eColor_highlighttext,
|
||||
eColor_inactiveborder,
|
||||
eColor_inactivecaption,
|
||||
eColor_inactivecaptiontext,
|
||||
eColor_infobackground,
|
||||
eColor_infotext,
|
||||
eColor_menu,
|
||||
eColor_menutext,
|
||||
eColor_scrollbar,
|
||||
eColor_threeddarkshadow,
|
||||
eColor_threedface,
|
||||
eColor_threedhighlight,
|
||||
eColor_threedlightshadow,
|
||||
eColor_threedshadow,
|
||||
eColor_window,
|
||||
eColor_windowframe,
|
||||
eColor_windowtext
|
||||
|
||||
} nsColorID;
|
||||
|
||||
typedef enum {
|
||||
eMetric_WindowTitleHeight,
|
||||
eMetric_WindowBorderWidth,
|
||||
eMetric_WindowBorderHeight,
|
||||
eMetric_Widget3DBorder,
|
||||
eMetric_TextFieldBorder, // Native border size
|
||||
eMetric_TextFieldHeight,
|
||||
eMetric_TextVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_TextShouldUseVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_TextHorizontalInsideMinimumPadding,
|
||||
eMetric_TextShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
|
||||
eMetric_ButtonHorizontalInsidePaddingNavQuirks,
|
||||
eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks,
|
||||
eMetric_CheckboxSize,
|
||||
eMetric_RadioboxSize,
|
||||
|
||||
eMetric_ListShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
|
||||
eMetric_ListHorizontalInsideMinimumPadding,
|
||||
|
||||
eMetric_ListShouldUseVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_ListVerticalInsidePadding, // needed only because of GTK
|
||||
|
||||
eMetric_CaretBlinkTime, // default, may be overriden by OS
|
||||
eMetric_CaretWidthTwips
|
||||
} nsMetricID;
|
||||
|
||||
typedef enum {
|
||||
eMetricFloat_TextFieldVerticalInsidePadding,
|
||||
eMetricFloat_TextFieldHorizontalInsidePadding,
|
||||
eMetricFloat_TextAreaVerticalInsidePadding,
|
||||
eMetricFloat_TextAreaHorizontalInsidePadding,
|
||||
eMetricFloat_ListVerticalInsidePadding,
|
||||
eMetricFloat_ListHorizontalInsidePadding,
|
||||
eMetricFloat_ButtonVerticalInsidePadding,
|
||||
eMetricFloat_ButtonHorizontalInsidePadding
|
||||
} nsMetricFloatID;
|
||||
|
||||
|
||||
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor) = 0;
|
||||
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric) = 0;
|
||||
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric) = 0;
|
||||
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
typedef enum {
|
||||
eMetricSize_TextField = 0,
|
||||
eMetricSize_TextArea = 1,
|
||||
eMetricSize_ListBox = 2,
|
||||
eMetricSize_ComboBox = 3,
|
||||
eMetricSize_Radio = 4,
|
||||
eMetricSize_CheckBox = 5,
|
||||
eMetricSize_Button = 6
|
||||
} nsMetricNavWidgetID;
|
||||
|
||||
typedef enum {
|
||||
eMetricSize_Courier = 0,
|
||||
eMetricSize_SansSerif = 1
|
||||
} nsMetricNavFontID;
|
||||
|
||||
// This method returns the actual (or nearest estimate)
|
||||
// of the Navigator size for a given form control for a given font
|
||||
// and font size. This is used in NavQuirks mode to see how closely
|
||||
// we match its size
|
||||
NS_IMETHOD GetNavSize(const nsMetricNavWidgetID aWidgetID,
|
||||
const nsMetricNavFontID aFontID,
|
||||
const PRInt32 aFontSize,
|
||||
nsSize &aSize) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define nsLAF nsILookAndFeel
|
||||
|
||||
#endif /* __nsILookAndFeel */
|
||||
@@ -1,190 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenu_h__
|
||||
#define nsIMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenu;
|
||||
class nsIMenuItem;
|
||||
class nsIMenuListener;
|
||||
|
||||
// {35A3DEC1-4992-11d2-8DBA-00609703C14E}
|
||||
#define NS_IMENU_IID \
|
||||
{ 0x35a3dec1, 0x4992, 0x11d2, \
|
||||
{ 0x8d, 0xba, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Menu widget
|
||||
*/
|
||||
class nsIMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the Menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu Access Key
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetAccessKey(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu Access Key
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetAccessKey(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu enabled state
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu enabled state
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetEnabled(PRBool* aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Query if this is the help menu. Mostly for MacOS voodoo.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsHelpMenu(PRBool* aIsHelpMenu) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Menu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsISupports* aItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menu items
|
||||
* This does count separators as items
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu or Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void** aData) = 0;
|
||||
|
||||
/**
|
||||
* Sets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetNativeData(void* aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement) = 0;
|
||||
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,120 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuBar_h__
|
||||
#define nsIMenuBar_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
// {BC658C81-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENUBAR_IID \
|
||||
{ 0xbc658c81, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* MenuBar widget
|
||||
*/
|
||||
class nsIMenuBar : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUBAR_IID)
|
||||
|
||||
/**
|
||||
* Creates the MenuBar
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget * aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuBar's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsIWidget *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Set the MenuBar's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetParent(nsIWidget *aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds the Menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menus
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetMenuCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetMenuAt(const PRUint32 aCount, nsIMenu *& aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertMenuAt(const PRUint32 aCount, nsIMenu *& aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenu(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menus
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Sets Native MenuHandle. Temporary hack for mac until
|
||||
* nsMenuBar does it's own construction
|
||||
*/
|
||||
NS_IMETHOD SetNativeData(void* aData) = 0;
|
||||
|
||||
/**
|
||||
* Draw the menubar
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Paint() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,189 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuItem_h__
|
||||
#define nsIMenuItem_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
// {7F045771-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENUITEM_IID \
|
||||
{ 0x7f045771, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
class nsIMenu;
|
||||
class nsIPopUpMenu;
|
||||
class nsIWidget;
|
||||
class nsIMenuListener;
|
||||
|
||||
enum {
|
||||
knsMenuItemNoModifier = 0,
|
||||
knsMenuItemShiftModifier = (1 << 0),
|
||||
knsMenuItemAltModifier = (1 << 1),
|
||||
knsMenuItemControlModifier = (1 << 2),
|
||||
knsMenuItemCommandModifier = (1 << 3)
|
||||
};
|
||||
|
||||
/**
|
||||
* MenuItem widget
|
||||
*/
|
||||
class nsIMenuItem : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUITEM_IID)
|
||||
|
||||
/**
|
||||
* Creates the MenuItem
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent,
|
||||
const nsString & aLabel,
|
||||
PRBool isSeparator) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuItem label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuItem label
|
||||
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu shortcut char
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetShortcutChar(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu shortcut char
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetShortcutChar(nsString &aText) = 0;
|
||||
/**
|
||||
* Sets whether the item is enabled or disabled
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is enabled or disabled
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetEnabled(PRBool *aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Sets whether the item is checked or not
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetChecked(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is checked or not
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetChecked(PRBool *aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Sets whether the item is a checkbox type
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetCheckboxType(PRBool aIsCheckbox) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is a checkbox type
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetCheckboxType(PRBool *aIsCheckbox) = 0;
|
||||
|
||||
/**
|
||||
* Gets the MenuItem Command identifier
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetCommand(PRUint32 & aCommand) = 0;
|
||||
|
||||
/**
|
||||
* Gets the target for MenuItem
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetTarget(nsIWidget *& aTarget) = 0;
|
||||
|
||||
/**
|
||||
* Gets Native Menu Handle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Indicates whether it is a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep) = 0;
|
||||
|
||||
/**
|
||||
* Sets the JavaScript Command to be invoked when a "gui" event occurs on a source widget
|
||||
* @param aStrCmd the JS command to be cached for later execution
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD SetCommand(const nsString & aStrCmd) = 0;
|
||||
|
||||
/**
|
||||
* Executes the "cached" JavaScript Command
|
||||
* @return NS_OK if the command was executed properly, otherwise an error code
|
||||
*/
|
||||
NS_IMETHOD DoCommand() = 0;
|
||||
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aDOMNode) = 0;
|
||||
NS_IMETHOD GetDOMNode(nsIDOMNode ** aDOMNode) = 0;
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aDOMElement) = 0;
|
||||
NS_IMETHOD GetDOMElement(nsIDOMElement ** aDOMElement) = 0;
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetModifiers(PRUint8 aModifiers) = 0;
|
||||
NS_IMETHOD GetModifiers(PRUint8 * aModifiers) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,85 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuListener_h__
|
||||
#define nsIMenuListener_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// TODO: This needs to be generated!
|
||||
// {BC658C81-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENULISTENER_IID \
|
||||
{ 0xbc658c81, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x9e } }
|
||||
|
||||
static NS_DEFINE_IID(kIMenuListenerIID, NS_IMENULISTENER_IID);
|
||||
|
||||
/**
|
||||
*
|
||||
* Menu event listener
|
||||
* This interface should only be implemented by the menu manager
|
||||
* These are registered with nsWindows to recieve menu events
|
||||
*/
|
||||
|
||||
class nsIMenuListener : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENULISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a menu item selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a menu selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a menu deselect event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
virtual nsEventStatus MenuConstruct(
|
||||
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
|
||||
nsIWidget * aParentWindow,
|
||||
|
||||
void * menubarNode,
|
||||
|
||||
void * aWebShell) = 0;
|
||||
|
||||
|
||||
|
||||
virtual nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIMenuListener_h__
|
||||
@@ -1,75 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIMouseListener_h__
|
||||
#define nsIMouseListener_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* Mouse up/down/move event listener
|
||||
*
|
||||
*/
|
||||
|
||||
// {c83f6b81-d7ce-11d2-8360-c4c894c4917c}
|
||||
#define NS_IMOUSELISTENER_IID \
|
||||
{ 0xc83f6b81, 0xd7ce, 0x11d2, { 0x83, 0x60, 0xc4, 0xc8, 0x94, 0xc4, 0x91, 0x7c } }
|
||||
|
||||
class nsIMouseListener : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMOUSELISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a mouse pressed event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MousePressed(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse release event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MouseReleased(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse clicked event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*
|
||||
*/
|
||||
virtual nsEventStatus MouseClicked(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse moved event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MouseMoved(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIMouseListener_h__
|
||||
@@ -1,138 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIPopUpMenu_h__
|
||||
#define nsIPopUpMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMenuItem.h"
|
||||
|
||||
class nsIMenu;
|
||||
class nsIWidget;
|
||||
|
||||
// {F6CD4F21-53AF-11d2-8DC4-00609703C14E}
|
||||
#define NS_IPOPUPMENU_IID \
|
||||
{ 0xf6cd4f21, 0x53af, 0x11d2, \
|
||||
{ 0x8d, 0xc4, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* PopUpMenu widget
|
||||
*/
|
||||
class nsIPopUpMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPOPUPMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the PopUpMenu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget * aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds a PopUpMenu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Adds a PopUpMenu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsIMenuItem * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Cascading PopUpMenu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Adds Separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menu items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Creates and inserts a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, const nsString & aMenuItemName) = 0;
|
||||
|
||||
/**
|
||||
* Creates and inserts a Separator at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertSeparator(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes an PopUpMenu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the PopUpMenu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Shows menu and waits for action
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD ShowMenu(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Gets parent widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsIWidget *& aParent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIRadioButton_h__
|
||||
#define nsIRadioButton_h__
|
||||
|
||||
#include "nsIButton.h"
|
||||
|
||||
#define NS_IRADIOBUTTON_IID \
|
||||
{ 0x18032ad4, 0xb265, 0x11d2, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
/**
|
||||
* RadioButton widget. Can show itself in a checked or unchecked state.
|
||||
* The RadioButton widget automatically shows itself checked or unchecked when clicked on.
|
||||
*/
|
||||
|
||||
class nsIRadioButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRADIOBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the button label
|
||||
*
|
||||
* @param aText button label
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Set the check state.
|
||||
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetState(const PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Get the check state.
|
||||
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetState(PRBool& aState) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIRadioButton_h__
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[uuid(23C2BA03-6C76-11d3-96ED-0060B0FB9956)]
|
||||
interface nsIRollupListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the object to rollup
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
void Rollup();
|
||||
};
|
||||
@@ -1,124 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIScrollbar_h__
|
||||
#define nsIScrollbar_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
|
||||
// {18032AD2-B265-11d1-AA2A-000000000000}
|
||||
#define NS_ISCROLLBAR_IID \
|
||||
{ 0x18032ad2, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Scrollbar, converts mouse input into values that can be used
|
||||
* to shift the contents of a window.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class nsIScrollbar : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLBAR_IID)
|
||||
|
||||
/**
|
||||
* Set the scrollbar range
|
||||
* @param aEndRange set range for scrollbar from 0 to aEndRange
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetMaxRange(PRUint32 aEndRange) = 0;
|
||||
|
||||
/**
|
||||
* Get the scrollbar range
|
||||
* @return the upper end of the scrollbar range
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetMaxRange(PRUint32& aMaxRange) = 0;
|
||||
|
||||
/**
|
||||
* Set the thumb position.
|
||||
* @param aPos a value between (startRange) and (endRange - thumbSize)
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetPosition(PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Get the thumb position.
|
||||
* @return a value between (startRange) and (endRange - thumbSize)
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetPosition(PRUint32& aPos) = 0;
|
||||
|
||||
/**
|
||||
* Set the thumb size.
|
||||
* @param aSize size of the thumb. Must be a value between
|
||||
* startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetThumbSize(PRUint32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the thumb size.
|
||||
* @return size of the thumb. The value is between
|
||||
* startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetThumbSize(PRUint32& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the line increment.
|
||||
* @param aSize size of the line increment. The value must
|
||||
* be between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetLineIncrement(PRUint32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the line increment.
|
||||
* @return size of the line increment. The value is
|
||||
* between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetLineIncrement(PRUint32& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set all scrollbar parameters at once
|
||||
* @param aMaxRange set range for scrollbar from 0 to aMaxRange
|
||||
* @param aThumbSize size of the thumb. Must be a value between
|
||||
* startRange and endRange
|
||||
* @param aPosition a value between (startRange) and (endRange - thumbSize)
|
||||
* @param aLineIncrement size of the line increment. The value must
|
||||
* be between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize,
|
||||
PRUint32 aPosition, PRUint32 aLineIncrement) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIScrollbar_h__
|
||||
@@ -1,43 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
[scriptable, uuid(B148EED1-236D-11d3-B35C-00A0CC3C1CDE)]
|
||||
interface nsISound : nsISupports
|
||||
{
|
||||
void Init();
|
||||
|
||||
void Play(in nsIFileSpec filespec);
|
||||
// void Stop();
|
||||
|
||||
void Beep();
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
extern nsresult
|
||||
NS_NewSound(nsISound** aSound);
|
||||
|
||||
%}
|
||||
@@ -1,158 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsITextAreaWidget_h__
|
||||
#define nsITextAreaWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsITextWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030012-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ITEXTAREAWIDGET_IID \
|
||||
{ 0xf8030012, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Multi-line text editor.
|
||||
* See nsITextWidget for capabilities.
|
||||
* Displays a scrollbar when the text content exceeds the number of lines
|
||||
* displayed.
|
||||
* Unlike a nsIWidget, The textarea must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
*/
|
||||
|
||||
class nsITextAreaWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTAREAWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Get the text of this component.
|
||||
*
|
||||
* @param aTextBuffer on return contains the text of this component
|
||||
* @param aBufferSize the size of the buffer passed in
|
||||
* @param aActualSize the number of char copied
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the text of this component.
|
||||
*
|
||||
* @param aText -- an object containing a copy of the text
|
||||
* @return the number of chars in the text string
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Insert text into this component.
|
||||
* When aStartPos and aEndPos are a valid range this function performs a replace.
|
||||
* When aStartPos and aEndPos are equal this function performs an insert.
|
||||
* When aStartPos and aEndPos are both -1 (0xFFFFFFFF) this function performs an append.
|
||||
* If aStartPos and aEndPos are out of range they are rounded to the closest end.
|
||||
*
|
||||
* @param aText the text to set
|
||||
* @param aStartPos starting position for inserting text
|
||||
* @param aEndPos ending position for inserting text
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Remove any content from this text widget
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD RemoveText(void) = 0;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters the widget can hold
|
||||
*
|
||||
* @param aChars maximum number of characters for this widget. if 0 then there isn't any limit
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the text widget to be read-only
|
||||
*
|
||||
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
|
||||
* PR_FALSE indicates the widget is writable.
|
||||
* @param PR_TRUE if it was read only. PR_FALSE if it was writable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
|
||||
|
||||
/**
|
||||
* Select all of the contents
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
|
||||
/**
|
||||
* Set the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Get the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Set the caret position
|
||||
* @param aPosition caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Get the caret position
|
||||
* @return caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
|
||||
};
|
||||
|
||||
#endif // nsITextAreaWidget_h__
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsITextWidget_h__
|
||||
#define nsITextWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030011-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ITEXTWIDGET_IID \
|
||||
{ 0xf8030011, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
struct nsTextWidgetInitData : public nsWidgetInitData {
|
||||
nsTextWidgetInitData()
|
||||
: mIsPassword(PR_FALSE),
|
||||
mIsReadOnly(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool mIsPassword;
|
||||
PRBool mIsReadOnly;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Single line text editor.
|
||||
* Unlike a nsIWidget, The text editor must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
*
|
||||
*/
|
||||
|
||||
class nsITextWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Get the text of this component.
|
||||
*
|
||||
* @param aTextBuffer on return contains the text of this component
|
||||
* @param aBufferSize the size of the buffer passed in
|
||||
* @param aActualSize the number of char copied
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the text of this component.
|
||||
*
|
||||
* @param aText -- an object containing a copy of the text
|
||||
* @return the number of chars in the text string
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Insert text into this component.
|
||||
* When aStartPos and aEndPos are a valid range this function performs a replace.
|
||||
* When aStartPos and aEndPos are equal this function performs an insert.
|
||||
* When aStartPos and aEndPos are both -1 (0xFFFFFFFF) this function performs an append.
|
||||
* If aStartPos and aEndPos are out of range they are rounded to the closest end.
|
||||
*
|
||||
* @param aText the text to set
|
||||
* @param aStartPos starting position for inserting text
|
||||
* @param aEndPos ending position for inserting text
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Remove any content from this text widget
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD RemoveText(void) = 0;
|
||||
|
||||
/**
|
||||
* Indicates a password will be entered.
|
||||
*
|
||||
* @param aIsPassword PR_TRUE shows contents as asterisks. PR_FALSE shows
|
||||
* contents as normal text.
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetPassword(PRBool aIsPassword) = 0;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters the widget can hold
|
||||
*
|
||||
* @param aChars maximum number of characters for this widget. if 0 then there isn't any limit
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the text widget to be read-only
|
||||
*
|
||||
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
|
||||
* PR_FALSE indicates the widget is writable.
|
||||
* @param PR_TRUE if it was read only. PR_FALSE if it was writable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
|
||||
|
||||
/**
|
||||
* Select all of the contents
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
|
||||
/**
|
||||
* Set the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Get the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Set the caret position
|
||||
* @param aPosition caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Get the caret position
|
||||
* @return caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsITextWidget_h__
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{ C++
|
||||
#include "prthread.h"
|
||||
%}
|
||||
|
||||
[ptr] native PRThread(PRThread);
|
||||
|
||||
|
||||
[uuid(18032BD0-B265-11d1-AA2A-000000000000)]
|
||||
interface nsIToolkit : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize this toolkit with aThread.
|
||||
* @param aThread The thread passed in runs the message pump.
|
||||
* NULL can be passed in, in which case a new thread gets created
|
||||
* and a message pump will run in that thread
|
||||
*
|
||||
*/
|
||||
void Init(in PRThread aThread);
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
extern NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult);
|
||||
%}
|
||||
@@ -1,123 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsIFormatConverter.idl"
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
// these probably shouldn't live here, but in some central repository shared
|
||||
// by the entire app.
|
||||
#define kTextMime "text/plain"
|
||||
#define kXIFMime "text/xif"
|
||||
#define kUnicodeMime "text/unicode"
|
||||
#define kHTMLMime "text/html"
|
||||
#define kAOLMailMime "AOLMAIL"
|
||||
#define kPNGImageMime "image/png"
|
||||
#define kJPEGImageMime "image/jpg"
|
||||
#define kGIFImageMime "image/gif"
|
||||
#define kDropFilesMime "text/dropfiles"
|
||||
|
||||
%}
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BC-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsITransferable : nsISupports
|
||||
{
|
||||
/**
|
||||
* Computes a list of flavors (mime types as nsISupportsString) that the transferable
|
||||
* can export, either through intrinsic knowledge or output data converters.
|
||||
*
|
||||
* @param aDataFlavorList fills list with supported flavors. This is a copy of
|
||||
* the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
nsISupportsArray flavorsTransferableCanExport ( ) ;
|
||||
|
||||
/**
|
||||
* Given a flavor retrieve the data.
|
||||
*
|
||||
* @param aFlavor (in parameter) the flavor of data to retrieve
|
||||
* @param aData the data. Some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen the length of the data
|
||||
*/
|
||||
void getTransferData ( in string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
|
||||
|
||||
/**
|
||||
* Returns the best flavor in the transferable, given those that have
|
||||
* been added to it with |AddFlavor()|
|
||||
*
|
||||
* @param aFlavor (out parameter) the flavor of data that was retrieved
|
||||
* @param aData the data. Some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen the length of the data
|
||||
*/
|
||||
void getAnyTransferData ( out string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
|
||||
|
||||
/**
|
||||
* Returns true if the data is large.
|
||||
*/
|
||||
boolean isLargeDataSet ( ) ;
|
||||
|
||||
///////////////////////////////
|
||||
// Setter part of interface
|
||||
///////////////////////////////
|
||||
|
||||
/**
|
||||
* Computes a list of flavors (mime types as nsISupportsString) that the transferable can
|
||||
* accept into it, either through intrinsic knowledge or input data converters.
|
||||
*
|
||||
* @param outFlavorList fills list with supported flavors. This is a copy of
|
||||
* the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
nsISupportsArray flavorsTransferableCanImport ( ) ;
|
||||
|
||||
/**
|
||||
* Sets the data in the transferable with the specified flavor. The transferable
|
||||
* will maintain its own copy the data, so it is not necessary to do that beforehand.
|
||||
*
|
||||
* @param aFlavor the flavor of data that is being set
|
||||
* @param aData the data, some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen the length of the data
|
||||
*/
|
||||
void setTransferData ( in string aFlavor, in nsISupports aData, in unsigned long aDataLen ) ;
|
||||
|
||||
/**
|
||||
* Add the data flavor, indicating that this transferable
|
||||
* can receive this type of flavor
|
||||
*
|
||||
* @param aDataFlavor a new data flavor to handle
|
||||
*/
|
||||
void addDataFlavor ( in string aDataFlavor ) ;
|
||||
|
||||
/**
|
||||
* Removes the data flavor matching the given one (string compare) and the data
|
||||
* that goes along with it.
|
||||
*
|
||||
* @param aDataFlavor a data flavor to remove
|
||||
*/
|
||||
void removeDataFlavor ( in string aDataFlavor ) ;
|
||||
|
||||
attribute nsIFormatConverter converter;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,725 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIWidget_h__
|
||||
#define nsIWidget_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIMouseListener.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// forward declarations
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
class nsIFontMetrics;
|
||||
class nsIToolkit;
|
||||
class nsIRenderingContext;
|
||||
class nsIEnumerator;
|
||||
class nsIDeviceContext;
|
||||
struct nsRect;
|
||||
struct nsFont;
|
||||
class nsIMenuBar;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
|
||||
/**
|
||||
* Callback function that processes events.
|
||||
* The argument is actually a subtype (subclass) of nsEvent which carries
|
||||
* platform specific information about the event. Platform specific code knows
|
||||
* how to deal with it.
|
||||
* The return value determines whether or not the default action should take place.
|
||||
*/
|
||||
|
||||
typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
|
||||
/**
|
||||
* Flags for the getNativeData function.
|
||||
* See getNativeData()
|
||||
*/
|
||||
#define NS_NATIVE_WINDOW 0
|
||||
#define NS_NATIVE_GRAPHIC 1
|
||||
#define NS_NATIVE_COLORMAP 2
|
||||
#define NS_NATIVE_WIDGET 3
|
||||
#define NS_NATIVE_DISPLAY 4
|
||||
#define NS_NATIVE_REGION 5
|
||||
#define NS_NATIVE_OFFSETX 6
|
||||
#define NS_NATIVE_OFFSETY 7
|
||||
#define NS_NATIVE_PLUGIN_PORT 8
|
||||
#define NS_NATIVE_SCREEN 9
|
||||
|
||||
// {18032AD5-B265-11d1-AA2A-000000000000}
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x18032ad5, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
|
||||
// Hide the native window systems real window type so as to avoid
|
||||
// including native window system types and api's. This is necessary
|
||||
// to ensure cross-platform code.
|
||||
typedef void* nsNativeWidget;
|
||||
|
||||
/**
|
||||
* Border styles
|
||||
*/
|
||||
|
||||
enum nsWindowType {
|
||||
// default top level window
|
||||
eWindowType_toplevel,
|
||||
// top level window but usually handled differently by the OS
|
||||
eWindowType_dialog,
|
||||
// used for combo boxes, etc
|
||||
eWindowType_popup,
|
||||
// child windows (contained inside a window on the desktop (has no border))
|
||||
eWindowType_child
|
||||
};
|
||||
|
||||
|
||||
enum nsBorderStyle
|
||||
{
|
||||
// no border, titlebar, etc.. opposite of all
|
||||
eBorderStyle_none = 0,
|
||||
|
||||
// all window decorations
|
||||
eBorderStyle_all = 1 << 0,
|
||||
|
||||
// enables the border on the window. these are only for decoration and are not resize hadles
|
||||
eBorderStyle_border = 1 << 1,
|
||||
|
||||
// enables the resize handles for the window. if this is set, border is implied to also be set
|
||||
eBorderStyle_resizeh = 1 << 2,
|
||||
|
||||
// enables the titlebar for the window
|
||||
eBorderStyle_title = 1 << 3,
|
||||
|
||||
// enables the window menu button on the title bar. this being on should force the title bar to display
|
||||
eBorderStyle_menu = 1 << 4,
|
||||
|
||||
// enables the minimize button so the user can minimize the window.
|
||||
// turned off for tranient windows since they can not be minimized seperate from their parent
|
||||
eBorderStyle_minimize = 1 << 5,
|
||||
|
||||
// enables the maxmize button so the user can maximize the window
|
||||
eBorderStyle_maximize = 1 << 6,
|
||||
|
||||
// show the close button
|
||||
eBorderStyle_close = 1 << 7,
|
||||
|
||||
// whatever the OS wants... i.e. don't do anything
|
||||
eBorderStyle_default = -1
|
||||
};
|
||||
|
||||
/**
|
||||
* Cursor types.
|
||||
*/
|
||||
|
||||
enum nsCursor { ///(normal cursor, usually rendered as an arrow)
|
||||
eCursor_standard,
|
||||
///(system is busy, usually rendered as a hourglass or watch)
|
||||
eCursor_wait,
|
||||
///(Selecting something, usually rendered as an IBeam)
|
||||
eCursor_select,
|
||||
///(can hyper-link, usually rendered as a human hand)
|
||||
eCursor_hyperlink,
|
||||
///(west/east sizing, usually rendered as ->||<-)
|
||||
eCursor_sizeWE,
|
||||
///(north/south sizing, usually rendered as sizeWE rotated 90 degrees)
|
||||
eCursor_sizeNS,
|
||||
eCursor_arrow_north,
|
||||
eCursor_arrow_north_plus,
|
||||
eCursor_arrow_south,
|
||||
eCursor_arrow_south_plus,
|
||||
eCursor_arrow_west,
|
||||
eCursor_arrow_west_plus,
|
||||
eCursor_arrow_east,
|
||||
eCursor_arrow_east_plus,
|
||||
eCursor_crosshair,
|
||||
//Don't know what 'move' cursor should be. See CSS2.
|
||||
eCursor_move,
|
||||
eCursor_help
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Basic struct for widget initialization data.
|
||||
* @see Create member function of nsIWidget
|
||||
*/
|
||||
|
||||
struct nsWidgetInitData {
|
||||
nsWidgetInitData()
|
||||
: clipChildren(PR_FALSE), clipSiblings(PR_FALSE),
|
||||
mWindowType(eWindowType_child),
|
||||
mBorderStyle(eBorderStyle_default)
|
||||
{
|
||||
}
|
||||
|
||||
// when painting exclude area occupied by child windows and sibling windows
|
||||
PRPackedBool clipChildren, clipSiblings;
|
||||
nsWindowType mWindowType;
|
||||
nsBorderStyle mBorderStyle;
|
||||
};
|
||||
|
||||
/**
|
||||
* The base class for all the widgets. It provides the interface for
|
||||
* all basic and necessary functionality.
|
||||
*/
|
||||
class nsIWidget : public nsISupports {
|
||||
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Create and initialize a widget.
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event. The widget should not
|
||||
* automatically clear the window to the background color. The
|
||||
* calling code must handle paint messages and clear the background
|
||||
* itself.
|
||||
*
|
||||
* @param parent or null if it's a top level window
|
||||
* @param aRect the widget dimension
|
||||
* @param aHandleEventFunction the event handler callback function
|
||||
* @param aContext
|
||||
* @param aAppShell the parent application shell. If nsnull,
|
||||
* the parent window's application shell will be used.
|
||||
* @param aToolkit
|
||||
* @param aInitData data that is used for widget initialization
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Create and initialize a widget with a native window parent
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event.
|
||||
*
|
||||
* @param aParent native window.
|
||||
* @param aRect the widget dimension
|
||||
* @param aHandleEventFunction the event handler callback function
|
||||
*/
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Accessor functions to get and set the client data associated with the
|
||||
* widget.
|
||||
*/
|
||||
//@{
|
||||
NS_IMETHOD GetClientData(void*& aClientData) = 0;
|
||||
NS_IMETHOD SetClientData(void* aClientData) = 0;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Close and destroy the internal native window.
|
||||
* This method does not delete the widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD Destroy(void) = 0;
|
||||
|
||||
/**
|
||||
* Return the parent Widget of this Widget or nsnull if this is a
|
||||
* top level window
|
||||
*
|
||||
* @return the parent widget or nsnull if it does not have a parent
|
||||
*
|
||||
*/
|
||||
virtual nsIWidget* GetParent(void) = 0;
|
||||
|
||||
/**
|
||||
* Return an nsEnumerator over the children of this widget.
|
||||
*
|
||||
* @return an enumerator over the list of children or nsnull if it does not
|
||||
* have any children
|
||||
*
|
||||
*/
|
||||
virtual nsIEnumerator* GetChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Show or hide this widget
|
||||
*
|
||||
* @param aState PR_TRUE to show the Widget, PR_FALSE to hide it
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Show(PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Make the window modal
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetModal(PRBool aModal) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether the window is visible
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsVisible(PRBool & aState) = 0;
|
||||
|
||||
/**
|
||||
* Move this widget.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
*
|
||||
**/
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Resize this widget.
|
||||
*
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Move or resize this widget.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the widget should be repainted if the size changes
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Set's the widget's z-index.
|
||||
*/
|
||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Get's the widget's z-index.
|
||||
*/
|
||||
NS_IMETHOD GetZIndex(PRInt32* aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Enable or disable this Widget
|
||||
*
|
||||
* @param aState PR_TRUE to enable the Widget, PR_FALSE to disable it.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Enable(PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Give focus to this widget.
|
||||
*/
|
||||
NS_IMETHOD SetFocus(void) = 0;
|
||||
|
||||
/**
|
||||
* Get this widget's outside dimensions relative to it's parent widget
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of this widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetBounds(nsRect &aRect) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get this widget's client area dimensions, if the window has a 3D border appearance
|
||||
* this returns the area inside the border, The x and y are always zero
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of the client area of this widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetClientBounds(nsRect &aRect) = 0;
|
||||
|
||||
/**
|
||||
* Gets the width and height of the borders
|
||||
* @param aWidth the width of the border
|
||||
* @param aHeight the height of the border
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Get the foreground color for this widget
|
||||
*
|
||||
* @return this widget's foreground color
|
||||
*
|
||||
*/
|
||||
virtual nscolor GetForegroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the foreground color for this widget
|
||||
*
|
||||
* @param aColor the new foreground color
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetForegroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the background color for this widget
|
||||
*
|
||||
* @return this widget's background color
|
||||
*
|
||||
*/
|
||||
|
||||
virtual nscolor GetBackgroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the background color for this widget
|
||||
*
|
||||
* @param aColor the new background color
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the font for this widget
|
||||
*
|
||||
* @return the font metrics
|
||||
*/
|
||||
|
||||
virtual nsIFontMetrics* GetFont(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the font for this widget
|
||||
*
|
||||
* @param aFont font to display. See nsFont for allowable fonts
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetFont(const nsFont &aFont) = 0;
|
||||
|
||||
/**
|
||||
* Get the cursor for this widget.
|
||||
*
|
||||
* @return this widget's cursor.
|
||||
*/
|
||||
|
||||
virtual nsCursor GetCursor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the cursor for this widget
|
||||
*
|
||||
* @param aCursor the new cursor for this widget
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate the widget and repaint it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate a specified rect for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate a specified region for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Force a synchronous repaint of the window if there are dirty rects.
|
||||
*
|
||||
* @see Invalidate()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Update() = 0;
|
||||
|
||||
/**
|
||||
* Adds a mouse listener to this widget
|
||||
* Any existing mouse listener is replaced
|
||||
*
|
||||
* @param aListener mouse listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddMouseListener(nsIMouseListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Adds an event listener to this widget
|
||||
* Any existing event listener is replaced
|
||||
*
|
||||
* @param aListener event listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddEventListener(nsIEventListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Adds a menu listener to this widget
|
||||
* Any existing menu listener is replaced
|
||||
*
|
||||
* @param aListener menu listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Return the widget's toolkit
|
||||
*
|
||||
* @return the toolkit this widget was created in. See nsToolkit.
|
||||
*/
|
||||
|
||||
virtual nsIToolkit* GetToolkit() = 0;
|
||||
|
||||
/**
|
||||
* Set the color map for this widget
|
||||
*
|
||||
* @param aColorMap color map for displaying this widget
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap) = 0;
|
||||
|
||||
/**
|
||||
* Scroll this widget.
|
||||
*
|
||||
* @param aDx amount to scroll along the x-axis
|
||||
* @param aDy amount to scroll along the y-axis.
|
||||
* @param aClipRect clipping rectangle to limit the scroll to.
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) = 0;
|
||||
|
||||
/**
|
||||
* Scroll an area of this widget.
|
||||
*
|
||||
* @param aRect source rectangle to scroll in the widget
|
||||
* @param aDx x offset from the source
|
||||
* @param aDy y offset from the source
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) = 0;
|
||||
|
||||
/**
|
||||
* Internal methods
|
||||
*/
|
||||
|
||||
//@{
|
||||
virtual void AddChild(nsIWidget* aChild) = 0;
|
||||
virtual void RemoveChild(nsIWidget* aChild) = 0;
|
||||
virtual void* GetNativeData(PRUint32 aDataType) = 0;
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) = 0;//~~~
|
||||
virtual nsIRenderingContext* GetRenderingContext() = 0;
|
||||
virtual nsIDeviceContext* GetDeviceContext() = 0;
|
||||
virtual nsIAppShell *GetAppShell() = 0;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Set border style
|
||||
* Must be called before Create.
|
||||
* @param aBorderStyle @see nsBorderStyle
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's title.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aTitle string displayed as the title of the widget
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aMenuBar the menubar
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar's visibility
|
||||
*
|
||||
* @param aShow PR_TRUE to show, PR_FALSE to hide
|
||||
*/
|
||||
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow) = 0;
|
||||
|
||||
/**
|
||||
* Convert from this widget coordinates to screen coordinates.
|
||||
*
|
||||
* @param aOldRect widget coordinates stored in the x,y members
|
||||
* @param aNewRect screen coordinates stored in the x,y members
|
||||
*/
|
||||
|
||||
NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect) = 0;
|
||||
|
||||
/**
|
||||
* Convert from screen coordinates to this widget's coordinates.
|
||||
*
|
||||
* @param aOldRect screen coordinates stored in the x,y members
|
||||
* @param aNewRect widget's coordinates stored in the x,y members
|
||||
*/
|
||||
|
||||
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect) = 0;
|
||||
|
||||
/**
|
||||
* When adjustments are to made to a whole set of child widgets, call this
|
||||
* before resizing/positioning the child windows to minimize repaints. Must
|
||||
* be followed by EndResizingChildren() after child windows have been
|
||||
* adjusted.
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD BeginResizingChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Call this when finished adjusting child windows. Must be preceded by
|
||||
* BeginResizingChildren().
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD EndResizingChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Returns the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Set the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Dispatches and event to the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) = 0;
|
||||
|
||||
|
||||
#ifdef LOSER
|
||||
/**
|
||||
* FSets the vertical scrollbar widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For printing and lightweight widgets
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect) = 0;
|
||||
|
||||
/**
|
||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD EnableDragDrop(PRBool aEnable) = 0;
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) = 0;
|
||||
|
||||
/**
|
||||
* Enables/Disables system mouse capture.
|
||||
* @param aCapture PR_TRUE enables mouse capture, PR_FALSE disables mouse capture
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture) = 0;
|
||||
|
||||
/**
|
||||
* Enables/Disables system capture of any and all events that would cause a
|
||||
* dropdown to be rolled up, This method ignores the aConsumeRollupEvent
|
||||
* parameter when aDoCapture is FALSE
|
||||
* @param aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
* @param aConsumeRollupEvent PR_TRUE consumes the rollup event, PR_FALSE dispatches rollup event
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent) = 0;
|
||||
|
||||
/**
|
||||
* Determine whether a given event should be processed assuming we are
|
||||
* the currently active modal window.
|
||||
* Note that the exact semantics of this method are platform-dependent.
|
||||
* The Macintosh, for instance, cares deeply that this method do exactly
|
||||
* as advertised. Gtk, for instance, handles modality in a completely
|
||||
* different fashion and does little if anything with this method.
|
||||
* @param aRealEvent event is real or a null placeholder (Macintosh)
|
||||
* @param aEvent void pointer to native event structure
|
||||
* @param aForWindow return value. PR_TRUE iff event should be processed.
|
||||
*/
|
||||
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent, PRBool *aForWindow) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIWidget_h__
|
||||
@@ -1,556 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Kevin McCluskey <kmcclusk@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* ... and other people
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIScriptableRegion.idl"
|
||||
#include "nsIRollupListener.idl"
|
||||
#include "nsIToolkit.idl"
|
||||
#include "nsIAppShell.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsRect.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIMouseListener.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// forward declarations
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
class nsIRenderingContext;
|
||||
class nsIEnumerator;
|
||||
class nsIDeviceContext;
|
||||
struct nsRect;
|
||||
struct nsFont;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
%}
|
||||
|
||||
[ptr] native nsGUIEvent(nsGUIEvent);
|
||||
[ptr] native nsIMouseListener(nsIMouseListener);
|
||||
[ptr] native nsIEventListener(nsIEventListener);
|
||||
[ptr] native nsIMenuListener(nsIMenuListener);
|
||||
[ptr] native nsIRegion(nsIRegion);
|
||||
[ptr] native nsRect(nsRect);
|
||||
[ref] native nsRectRef(nsRect);
|
||||
[ptr] native nsFont(nsFont);
|
||||
[ptr] native nsColorMap(nsColorMap);
|
||||
|
||||
[ptr] native nsIRenderingContext(nsIRenderingContext);
|
||||
[ptr] native nsIDeviceContext(nsIDeviceContext);
|
||||
|
||||
native nscolor(nscolor);
|
||||
native nscoord(nscoord);
|
||||
native nsEventStatus(nsEventStatus);
|
||||
[ref] native nsEventStatusRef(nsEventStatus);
|
||||
native PR_CALLBACK(PR_CALLBACKK);
|
||||
native EVENT_CALLBACK(EVENT_CALLBACK);
|
||||
|
||||
typedef long nsCursor;
|
||||
|
||||
|
||||
/*
|
||||
* Hide the native window systems real window type so as to avoid
|
||||
* including native window system types and api's. This is necessary
|
||||
* to ensure cross-platform code.
|
||||
*/
|
||||
typedef voidStar nsNativeWidget;
|
||||
|
||||
|
||||
%{ C++
|
||||
typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
|
||||
|
||||
/**
|
||||
* Basic struct for widget initialization data.
|
||||
* @see Create member function of nsIWidget
|
||||
*/
|
||||
|
||||
struct nsWidgetInitData {
|
||||
nsWidgetInitData()
|
||||
: clipChildren(PR_FALSE), clipSiblings(PR_FALSE)
|
||||
// mWindowType(eWindowType_child),
|
||||
// mBorderStyle(eBorderStyle_default)
|
||||
{
|
||||
}
|
||||
|
||||
// when painting exclude area occupied by child windows and sibling windows
|
||||
PRPackedBool clipChildren, clipSiblings;
|
||||
// nsWindowType mWindowType;
|
||||
// nsBorderStyle mBorderStyle;
|
||||
};
|
||||
%}
|
||||
|
||||
|
||||
[uuid(18032AD5-B265-11d1-AA2A-000000000000)]
|
||||
interface nsIWidget : nsISupports
|
||||
{
|
||||
|
||||
/*
|
||||
* Flags for GetNativeData()
|
||||
*/
|
||||
const short NS_NATIVE_WINDOW = 0;
|
||||
const short NS_NATIVE_GRAPHIC = 1;
|
||||
const short NS_NATIVE_COLORMAP = 2;
|
||||
const short NS_NATIVE_WIDGET = 3;
|
||||
const short NS_NATIVE_DISPLAY = 4;
|
||||
const short NS_NATIVE_REGION = 5;
|
||||
const short NS_NATIVE_OFFSETX = 6;
|
||||
const short NS_NATIVE_OFFSETY = 7;
|
||||
const short NS_NATIVE_PLUGIN_PORT = 8;
|
||||
const short NS_NATIVE_SCREEN = 9;
|
||||
|
||||
|
||||
/**
|
||||
* Cursor types.
|
||||
*/
|
||||
|
||||
//(normal cursor, usually rendered as an arrow)
|
||||
const long eCursor_standard = 0;
|
||||
//(system is busy, usually rendered as a hourglass or watch)
|
||||
const long eCursor_wait = 1;
|
||||
//(Selecting something, usually rendered as an IBeam)
|
||||
const long eCursor_select = 2;
|
||||
//(can hyper-link, usually rendered as a human hand)
|
||||
const long eCursor_hyperlink = 3;
|
||||
//(west/east sizing, usually rendered as ->||<-)
|
||||
const long eCursor_sizeWE = 4;
|
||||
//(north/south sizing, usually rendered as sizeWE rotated 90 degrees)
|
||||
const long eCursor_sizeNS = 5;
|
||||
const long eCursor_arrow_north = 6;
|
||||
const long eCursor_arrow_north_plus = 7;
|
||||
const long eCursor_arrow_south = 8;
|
||||
const long eCursor_arrow_south_plus = 9;
|
||||
const long eCursor_arrow_west = 10;
|
||||
const long eCursor_arrow_west_plus = 11;
|
||||
const long eCursor_arrow_east = 12;
|
||||
const long eCursor_arrow_east_plus = 13;
|
||||
const long eCursor_crosshair = 14;
|
||||
//Don't know what 'move' cursor should be. See CSS2.
|
||||
const long eCursor_move = 15;
|
||||
const long eCursor_help = 16;
|
||||
|
||||
|
||||
/**
|
||||
* initialize a widget
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event. The widget should not
|
||||
* automatically clear the window to the background color. The
|
||||
* calling code must handle paint messages and clear the background
|
||||
* itself.
|
||||
*
|
||||
* @param aAppShell the parent application shell. If nsnull,
|
||||
* the parent window's application shell will be used.
|
||||
* @param aToolkit toolkit
|
||||
* @param aContext device context
|
||||
* @param aEventFunction the event handler callback function
|
||||
*
|
||||
*/
|
||||
void initWidget(in nsIAppShell aAppShell,
|
||||
in nsIToolkit aToolkit,
|
||||
in nsIDeviceContext aContext,
|
||||
in EVENT_CALLBACK aEventFunction);
|
||||
|
||||
/**
|
||||
* Get some kind of native data
|
||||
*/
|
||||
voidStar getNativeData(in PRUint32 aDataType);
|
||||
|
||||
/**
|
||||
* Move this widget.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
*
|
||||
**/
|
||||
void move(in PRInt32 aX, in PRInt32 aY);
|
||||
|
||||
/**
|
||||
* Resize this widget.
|
||||
*
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
void resize(in PRInt32 aWidth,
|
||||
in PRInt32 aHeight,
|
||||
in PRBool aRepaint);
|
||||
|
||||
/**
|
||||
* Move and resize this widget.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the widget should be repainted if the size changes
|
||||
*
|
||||
*/
|
||||
void moveResize(in PRInt32 aX,
|
||||
in PRInt32 aY,
|
||||
in PRInt32 aWidth,
|
||||
in PRInt32 aHeight,
|
||||
in PRBool aRepaint);
|
||||
|
||||
/**
|
||||
* Enable or disable this Widget
|
||||
*
|
||||
* @param aState PR_TRUE to enable the Widget, PR_FALSE to disable it.
|
||||
*
|
||||
*/
|
||||
void enable(in PRBool aState);
|
||||
|
||||
|
||||
// XXX GO AWAY
|
||||
|
||||
/**
|
||||
* Get this widget's outside dimensions relative to it's parent widget
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of this widget
|
||||
*
|
||||
*/
|
||||
// readonly attribute nsRect Bounds;
|
||||
|
||||
// this is really out..
|
||||
void getBounds(in nsRectRef aRect);
|
||||
|
||||
|
||||
// XXX keep this, but make it ints
|
||||
/**
|
||||
* Get this widget's client area dimensions, if the window has a 3D border appearance
|
||||
* this returns the area inside the border, The x and y are always zero
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of the client area of this widget
|
||||
*
|
||||
*/
|
||||
// readonly attribute nsRect ClientBounds;
|
||||
|
||||
// this is really out..
|
||||
void getClientBounds(in nsRectRef aRect);
|
||||
|
||||
|
||||
|
||||
// Is this still used?
|
||||
/**
|
||||
* Returns the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
void getPreferredSize(out PRInt32 aWidth,
|
||||
out PRInt32 aHeight);
|
||||
|
||||
/**
|
||||
* Set the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
void setPreferredSize(in PRInt32 aWidth, in PRInt32 aHeight);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Invalidate the widget and repaint it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
void invalidate(in PRBool aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Invalidate a specified rect for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
void invalidateRect([const] in nsRect aRect, in PRBool aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Invalidate a specified rect for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
// void InvalidateRegion([const] in nsIScriptableRegion aRegion, in PRBool aIsSynchronous);
|
||||
void invalidateRegion([const] in nsIRegion aRegion, in PRBool aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Force a synchronous repaint of the window if there are dirty rects.
|
||||
*
|
||||
* @see Invalidate()
|
||||
*/
|
||||
void update();
|
||||
|
||||
|
||||
/**
|
||||
* Convert from this widget coordinates to screen coordinates.
|
||||
*
|
||||
* @param aOldRect widget coordinates stored in the x,y members
|
||||
* @param aNewRect screen coordinates stored in the x,y members
|
||||
*/
|
||||
void widgetToScreen([const] in nsRect aOldRect, out nsRect aNewRect);
|
||||
|
||||
/**
|
||||
* Convert from screen coordinates to this widget's coordinates.
|
||||
*
|
||||
* @param aOldRect screen coordinates stored in the x,y members
|
||||
* @param aNewRect widget's coordinates stored in the x,y members
|
||||
*/
|
||||
void screenToWidget([const] in nsRect aOldRect, out nsRect aNewRect);
|
||||
|
||||
// is this used?
|
||||
void convertToDeviceCoordinates(inout nscoord aX, inout nscoord aY);
|
||||
|
||||
|
||||
// can this go away?
|
||||
/**
|
||||
* For printing and lightweight widgets
|
||||
*
|
||||
*/
|
||||
void paint(in nsIRenderingContext aRenderingContext,
|
||||
[const] in nsRect aDirtyRect);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||
*
|
||||
*/
|
||||
void enableDragDrop(in PRBool aEnable);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enables/Disables system mouse capture.
|
||||
* @param aCapture PR_TRUE enables mouse capture, PR_FALSE disables mouse capture
|
||||
*
|
||||
*/
|
||||
void captureMouse(in PRBool aCapture);
|
||||
|
||||
/**
|
||||
* Enables/Disables system capture of any and all events that would cause a
|
||||
* dropdown to be rolled up, This method ignores the aConsumeRollupEvent
|
||||
* parameter when aDoCapture is FALSE
|
||||
* @param aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
* @param aConsumeRollupEvent PR_TRUE consumes the rollup event, PR_FALSE dispatches rollup event
|
||||
*
|
||||
*/
|
||||
void captureRollupEvents(in nsIRollupListener aListener, in PRBool aDoCapture, in PRBool aConsumeRollupEvent);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adds a mouse listener to this widget
|
||||
* Any existing mouse listener is replaced
|
||||
*
|
||||
* @param aListener mouse listener to add to this widget.
|
||||
*/
|
||||
void addMouseListener(in nsIMouseListener aListener);
|
||||
|
||||
/**
|
||||
* Adds an event listener to this widget
|
||||
* Any existing event listener is replaced
|
||||
*
|
||||
* @param aListener event listener to add to this widget.
|
||||
*/
|
||||
void addEventListener(in nsIEventListener aListener);
|
||||
|
||||
/**
|
||||
* Adds a menu listener to this widget
|
||||
* Any existing menu listener is replaced
|
||||
*
|
||||
* @param aListener menu listener to add to this widget.
|
||||
*/
|
||||
void addMenuListener(in nsIMenuListener aListener);
|
||||
|
||||
|
||||
// is this an internal method?
|
||||
/**
|
||||
* Dispatches and event to the widget
|
||||
*
|
||||
*/
|
||||
void dispatchEvent(in nsGUIEvent event, in nsEventStatusRef aStatus);
|
||||
|
||||
|
||||
/**
|
||||
* Internal methods
|
||||
*/
|
||||
void addChild(in nsIWidget aChild);
|
||||
void removeChild(in nsIWidget aChild);
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
|
||||
/**
|
||||
* Device Context used to do printing... probably shouldn't be here
|
||||
*/
|
||||
readonly attribute nsIDeviceContext deviceContext;
|
||||
|
||||
/* attributes */
|
||||
|
||||
/**
|
||||
* Get the AppShell
|
||||
*/
|
||||
readonly attribute nsIAppShell appShell;
|
||||
|
||||
/**
|
||||
* Get the nsIToolkit
|
||||
*/
|
||||
readonly attribute nsIToolkit toolkit;
|
||||
|
||||
/**
|
||||
* callback for the event
|
||||
*/
|
||||
[noscript] readonly attribute EVENT_CALLBACK eventFunction;
|
||||
|
||||
|
||||
/* things that MUST be set AFTER the widget is created */
|
||||
|
||||
/**
|
||||
* Get and Set the widget's z-index.
|
||||
*/
|
||||
attribute PRInt32 zIndex;
|
||||
|
||||
/**
|
||||
* Set/Get the foreground color for this widget
|
||||
*
|
||||
* @param aColor the new foreground color
|
||||
*
|
||||
*/
|
||||
attribute nscolor foregroundColor;
|
||||
|
||||
/**
|
||||
* Set/Get the background color for this widget
|
||||
*
|
||||
* @param aColor the new background color
|
||||
*
|
||||
*/
|
||||
attribute nscolor backgroundColor;
|
||||
|
||||
/**
|
||||
* Set/Get the font for this widget
|
||||
*
|
||||
* @param aFont font to display. See nsFont for allowable fonts
|
||||
*/
|
||||
attribute nsFont font;
|
||||
|
||||
/**
|
||||
* Set/Get the cursor for this widget
|
||||
*
|
||||
* @param aCursor the new cursor for this widget
|
||||
*/
|
||||
|
||||
attribute nsCursor cursor;
|
||||
|
||||
/**
|
||||
* Set the color map for this widget
|
||||
*
|
||||
* @param aColorMap color map for displaying this widget
|
||||
*
|
||||
*/
|
||||
attribute nsColorMap colorMap;
|
||||
|
||||
/**
|
||||
* Accessor functions to get and set the client data associated with the
|
||||
* widget.
|
||||
*/
|
||||
attribute voidStar clientData;
|
||||
|
||||
/**
|
||||
* Return an nsEnumerator over the children of this widget.
|
||||
*
|
||||
* @return an enumerator over the list of children or nsnull if it does not
|
||||
* have any children
|
||||
*
|
||||
*/
|
||||
readonly attribute nsIEnumerator children;
|
||||
|
||||
%{ C++
|
||||
/* backwards compat stuff */
|
||||
NS_IMETHOD Show(PRBool aShow) = 0;
|
||||
|
||||
NS_IMETHOD IsVisible(PRBool & aState) = 0;
|
||||
NS_IMETHOD Resize(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
virtual nscolor GetForegroundColor(void) = 0;
|
||||
virtual nscolor GetBackgroundColor(void) = 0;
|
||||
|
||||
NS_IMETHOD SetFont(const nsFont &aFont) = 0;
|
||||
virtual nsIFontMetrics* GetFont(void) = 0;
|
||||
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous) = 0;
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight) = 0;
|
||||
|
||||
virtual nsIWidget* GetParent(void) = 0;
|
||||
|
||||
virtual nsIEnumerator* GetChildren(void) = 0;
|
||||
|
||||
virtual void* GetNativeData(PRUint32 aDataType) = 0;
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) = 0;
|
||||
virtual nsIRenderingContext* GetRenderingContext() = 0;
|
||||
virtual nsIDeviceContext* GetDeviceContext() = 0;
|
||||
virtual nsIAppShell *GetAppShell() = 0;
|
||||
virtual nsIToolkit* GetToolkit() = 0;
|
||||
|
||||
/* the big ugly ones */
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
%}
|
||||
|
||||
};
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Kevin McCluskey <kmcclusk@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* ... and other people
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIWidget.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsRect.h"
|
||||
#include "nsIMouseListener.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// forward declarations
|
||||
struct nsRect;
|
||||
class nsIMenuBar;
|
||||
%}
|
||||
|
||||
[ptr] native nsIMenuBar(nsIMenuBar);
|
||||
|
||||
typedef long nsBorderStyle;
|
||||
typedef long nsWindowType;
|
||||
|
||||
|
||||
[uuid(491359ea-1dd2-11b2-af7c-bb0346efd9b6)]
|
||||
interface nsIWindow : nsIWidget
|
||||
{
|
||||
/*
|
||||
* types of windows
|
||||
*/
|
||||
const long eWindowType_toplevel = 0;
|
||||
const long eWindowType_dialog = 1;
|
||||
const long eWindowType_popup = 2;
|
||||
const long eWindowType_child = 3;
|
||||
|
||||
|
||||
/*
|
||||
* Border styles
|
||||
*/
|
||||
// no border, titlebar, etc.. opposite of all
|
||||
const long eBorderStyle_none = 0;
|
||||
|
||||
// all window decorations
|
||||
const long eBorderStyle_all = 1 << 0;
|
||||
|
||||
// enables the border on the window. these are only for decoration and are not resize hadles
|
||||
const long eBorderStyle_border = 1 << 1;
|
||||
|
||||
// enables the resize handles for the window. if this is set, border is implied to also be set
|
||||
const long eBorderStyle_resizeh = 1 << 2;
|
||||
|
||||
// enables the titlebar for the window
|
||||
const long eBorderStyle_title = 1 << 3;
|
||||
|
||||
// enables the window menu button on the title bar. this being on should force the title bar to display
|
||||
const long eBorderStyle_menu = 1 << 4;
|
||||
|
||||
// enables the minimize button so the user can minimize the window.
|
||||
// turned off for tranient windows since they can not be minimized seperate from their parent
|
||||
const long eBorderStyle_minimize = 1 << 5;
|
||||
|
||||
// enables the maxmize button so the user can maximize the window
|
||||
const long eBorderStyle_maximize = 1 << 6;
|
||||
|
||||
// show the close button
|
||||
const long eBorderStyle_close = 1 << 7;
|
||||
|
||||
// whatever the OS wants... i.e. don't do anything
|
||||
const long eBorderStyle_default = -1;
|
||||
|
||||
|
||||
/**
|
||||
* initialize a window
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event. The widget should not
|
||||
* automatically clear the window to the background color. The
|
||||
* calling code must handle paint messages and clear the background
|
||||
* itself.
|
||||
*
|
||||
* @param aWindowType type of window to create
|
||||
* @param aBorderStyle border style of the window to create
|
||||
*
|
||||
*/
|
||||
void initWindowStyle(in nsWindowType aWindowType,
|
||||
in nsBorderStyle aBorderStyle);
|
||||
|
||||
/**
|
||||
* Make the window modal
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
void setModal(in boolean modal);
|
||||
|
||||
/**
|
||||
* Gets the width and height of the borders
|
||||
* @param aWidth the width of the border
|
||||
* @param aHeight the height of the border
|
||||
*
|
||||
*/
|
||||
void getBorderSize(out PRInt32 aWidth, out PRInt32 aHeight);
|
||||
|
||||
/**
|
||||
* Scroll this widget.
|
||||
*
|
||||
* @param aDx amount to scroll along the x-axis
|
||||
* @param aDy amount to scroll along the y-axis.
|
||||
* @param aClipRect clipping rectangle to limit the scroll to.
|
||||
*
|
||||
*/
|
||||
void scroll(in PRInt32 aDx, in PRInt32 aDy, in nsRect aClipRect);
|
||||
|
||||
/**
|
||||
* Scroll an area of this widget.
|
||||
*
|
||||
* @param aRect source rectangle to scroll in the widget
|
||||
* @param aDx x offset from the source
|
||||
* @param aDy y offset from the source
|
||||
*
|
||||
*/
|
||||
void scrollRect(in nsRectRef aSrcRect, in PRInt32 aDx, in PRInt32 aDy);
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aMenuBar the menubar
|
||||
*/
|
||||
void setMenuBar(in nsIMenuBar aMenuBar);
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar's visibility
|
||||
*
|
||||
* @param aShow PR_TRUE to show, PR_FALSE to hide
|
||||
*/
|
||||
void showMenuBar(in PRBool aShow);
|
||||
|
||||
/**
|
||||
* When adjustments are to made to a whole set of child widgets, call this
|
||||
* before resizing/positioning the child windows to minimize repaints. Must
|
||||
* be followed by EndResizingChildren() after child windows have been
|
||||
* adjusted.
|
||||
*
|
||||
*/
|
||||
void beginResizingChildren();
|
||||
|
||||
/**
|
||||
* Call this when finished adjusting child windows. Must be preceded by
|
||||
* BeginResizingChildren().
|
||||
*
|
||||
*/
|
||||
void endResizingChildren();
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
|
||||
/**
|
||||
* Window type
|
||||
*/
|
||||
readonly attribute nsWindowType windowType;
|
||||
|
||||
/**
|
||||
* Border style
|
||||
*/
|
||||
readonly attribute nsBorderStyle borderStyle;
|
||||
|
||||
};
|
||||
@@ -1,64 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsRepeater_h___
|
||||
#define nsRepeater_h___
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
class EventRecord;
|
||||
|
||||
class NS_BASE Repeater {
|
||||
public:
|
||||
|
||||
Repeater();
|
||||
virtual ~Repeater();
|
||||
|
||||
virtual void RepeatAction(const EventRecord &aMacEvent) = 0;
|
||||
|
||||
void StartRepeating();
|
||||
void StopRepeating();
|
||||
void StartIdling();
|
||||
void StopIdling();
|
||||
|
||||
static void DoRepeaters(const EventRecord &aMacEvent);
|
||||
static void DoIdlers(const EventRecord &aMacEvent);
|
||||
|
||||
protected:
|
||||
|
||||
void AddToRepeatList();
|
||||
void RemoveFromRepeatList();
|
||||
void AddToIdleList();
|
||||
void RemoveFromIdleList();
|
||||
|
||||
static Repeater* sRepeaters;
|
||||
static Repeater* sIdlers;
|
||||
|
||||
bool mRepeating;
|
||||
bool mIdling;
|
||||
Repeater* mPrevRptr;
|
||||
Repeater* mNextRptr;
|
||||
Repeater* mPrevIdlr;
|
||||
Repeater* mNextIdlr;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// Convience macros for converting nsString's to chars +
|
||||
// creating temporary char[] bufs.
|
||||
|
||||
#ifndef NS_STR_UTIL_H
|
||||
#define NS_STR_UTIL_H
|
||||
|
||||
// nsString to temporary char[] macro
|
||||
|
||||
// Convience MACROS to convert an nsString to a char * which use a
|
||||
// static char array if possible to reduce memory fragmentation,
|
||||
// otherwise they allocate a char[] which must be freed.
|
||||
// REMEMBER to always use the NS_FREE_STR_BUF after using the
|
||||
// NS_ALLOC_STR_BUF. You can not nest NS_ALLOC_STR_BUF's.
|
||||
|
||||
#define NS_ALLOC_CHAR_BUF(aBuf, aSize, aActualSize) \
|
||||
int _ns_tmpActualSize = aActualSize; \
|
||||
char _ns_smallBuffer[aSize]; \
|
||||
char * const aBuf = _ns_tmpActualSize <= aSize ? _ns_smallBuffer : new char[_ns_tmpActualSize];
|
||||
|
||||
#define NS_FREE_CHAR_BUF(aBuf) \
|
||||
if (aBuf != _ns_smallBuffer) \
|
||||
delete[] aBuf;
|
||||
|
||||
#define NS_ALLOC_STR_BUF(aBuf, aStrName, aTempSize) \
|
||||
NS_ALLOC_CHAR_BUF(aBuf, aTempSize, aStrName.Length()+1); \
|
||||
aStrName.ToCString(aBuf, aStrName.Length()+1);
|
||||
|
||||
#define NS_FREE_STR_BUF(aBuf) \
|
||||
NS_FREE_CHAR_BUF(aBuf)
|
||||
|
||||
|
||||
#endif // NSStringUtil
|
||||
@@ -1,141 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsWidgetSupport_h__
|
||||
#define nsWidgetSupport_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
||||
struct nsRect;
|
||||
class nsITextAreaWidget;
|
||||
class nsIFileWidget;
|
||||
class nsIAppShell;
|
||||
class nsIButton;
|
||||
class nsIComboBox;
|
||||
class nsIEventListener;
|
||||
class nsILabel;
|
||||
class nsIListBox;
|
||||
class nsIListWidget;
|
||||
class nsILookAndFeel;
|
||||
class nsIMouseListener;
|
||||
class nsIToolkit;
|
||||
class nsIWidget;
|
||||
class nsICheckButton;
|
||||
class nsIScrollbar;
|
||||
class nsIRadioButton;
|
||||
class nsITextWidget;
|
||||
class nsIBrowserWindow;
|
||||
|
||||
// These are a series of support methods which help in the creation
|
||||
// of widgets. They are not needed, but are provided as a convenience
|
||||
// mechanism when creating widgets
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateButton( nsISupports* aParent,
|
||||
nsIButton* aButton,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateCheckButton( nsISupports* aParent,
|
||||
nsICheckButton* aCheckButton,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateRadioButton( nsISupports* aParent,
|
||||
nsIRadioButton* aButton,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateLabel( nsISupports* aParent,
|
||||
nsILabel* aLabel,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateTextWidget(nsISupports* aParent,
|
||||
nsITextWidget* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateTextAreaWidget(nsISupports* aParent,
|
||||
nsITextAreaWidget* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateListBox(nsISupports* aParent,
|
||||
nsIListBox* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateComboBox(nsISupports* aParent,
|
||||
nsIComboBox* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateScrollBar(nsISupports* aParent,
|
||||
nsIScrollbar* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_ShowWidget(nsISupports* aWidget, PRBool aShow);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_MoveWidget(nsISupports* aWidget, PRUint32 aX, PRUint32 aY);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_EnableWidget(nsISupports* aWidget, PRBool aEnable);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_SetFocusToWidget(nsISupports* aWidget);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_GetWidgetNativeData(nsISupports* aWidget, void** aNativeData);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user