Compare commits
22 Commits
NETSCAPE_7
...
ServMgrCha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
884d6b6faf | ||
|
|
6657c89b06 | ||
|
|
c741bf8ab0 | ||
|
|
08712aa063 | ||
|
|
9d6b22d199 | ||
|
|
9bb64c62ea | ||
|
|
51f9752f37 | ||
|
|
bf54296f21 | ||
|
|
a50550d4ab | ||
|
|
d82dfd0b3b | ||
|
|
8ef3070750 | ||
|
|
9c40a03037 | ||
|
|
837b676d36 | ||
|
|
25e0bc0b9a | ||
|
|
1a080a1ad8 | ||
|
|
a865f96cfd | ||
|
|
6553198fc2 | ||
|
|
b7b4f31ac2 | ||
|
|
09aa5e7ef9 | ||
|
|
07c407d3b8 | ||
|
|
dca6d49c7a | ||
|
|
94274aade6 |
@@ -1,80 +0,0 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::BuildCore;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Where have the build options gone?
|
||||
#
|
||||
# The various build flags have been centralized into one place.
|
||||
# The master list of options is in MozBuildFlags.txt. However,
|
||||
# you should never need to edit that file, or this one.
|
||||
#
|
||||
# To customize what gets built, or where to start the build,
|
||||
# edit the $prefs_file_name file in
|
||||
# System Folder:Preferences:Mozilla build prefs:
|
||||
# Documentation is provided in that file.
|
||||
#-------------------------------------------------------------
|
||||
|
||||
my($prefs_file_name) = "Mozilla opt build prefs";
|
||||
my($config_header_file_name) = ":mozilla:config:mac:DefinesOptions.h";
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
# Hash of input files for this build. Eventually, there will be
|
||||
# input files for manifests, and projects too.
|
||||
my(%inputfiles) = (
|
||||
"buildflags", "MozillaBuildFlags.txt",
|
||||
"checkoutdata", "MozillaCheckoutList.txt",
|
||||
"buildprogress", "¥ Mozilla opt progress",
|
||||
"buildmodule", "MozillaBuildList.pm",
|
||||
"checkouttime", "Mozilla last checkout"
|
||||
);
|
||||
#-------------------------------------------------------------
|
||||
# end build hashes
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# set the build root directory, which is the the dir above mozilla
|
||||
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
|
||||
|
||||
# Set up all the flags on $main::, like DEBUG, CARBON etc.
|
||||
# Override the defaults using the preferences files.
|
||||
SetupDefaultBuildOptions(0, ":mozilla:dist:viewer:", $config_header_file_name);
|
||||
|
||||
my($do_checkout) = 0;
|
||||
my($do_build) = 1;
|
||||
|
||||
RunBuild($do_checkout, $do_build, \%inputfiles, $prefs_file_name);
|
||||
@@ -1,80 +0,0 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::BuildCore;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Where have the build options gone?
|
||||
#
|
||||
# The various build flags have been centralized into one place.
|
||||
# The master list of options is in MozBuildFlags.txt. However,
|
||||
# you should never need to edit that file, or this one.
|
||||
#
|
||||
# To customize what gets built, or where to start the build,
|
||||
# edit the $prefs_file_name file in
|
||||
# System Folder:Preferences:Mozilla build prefs:
|
||||
# Documentation is provided in that file.
|
||||
#-------------------------------------------------------------
|
||||
|
||||
my($prefs_file_name) = "Mozilla debug build prefs";
|
||||
my($config_header_file_name) = ":mozilla:config:mac:DefinesOptionsDebug.h";
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
# Hash of input files for this build. Eventually, there will be
|
||||
# input files for manifests, and projects too.
|
||||
my(%inputfiles) = (
|
||||
"buildflags", "MozillaBuildFlags.txt",
|
||||
"checkoutdata", "MozillaCheckoutList.txt",
|
||||
"buildprogress", "¥ Mozilla debug progress",
|
||||
"buildmodule", "MozillaBuildList.pm",
|
||||
"checkouttime", "Mozilla last checkout"
|
||||
);
|
||||
#-------------------------------------------------------------
|
||||
# end build hashes
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# set the build root directory, which is the the dir above mozilla
|
||||
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
|
||||
|
||||
# Set up all the flags on $main::, like DEBUG, CARBON etc.
|
||||
# Override the defaults using the preferences files.
|
||||
SetupDefaultBuildOptions(1, ":mozilla:dist:viewer_debug:", $config_header_file_name);
|
||||
|
||||
my($do_pull) = 0; # overridden by flags and prefs
|
||||
my($do_build) = 1;
|
||||
|
||||
RunBuild($do_pull, $do_build, \%inputfiles, $prefs_file_name);
|
||||
@@ -1,595 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::BuildCore;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use vars qw( @ISA @EXPORT );
|
||||
|
||||
# perl includes
|
||||
use Cwd;
|
||||
use POSIX;
|
||||
use Time::Local;
|
||||
use File::Basename;
|
||||
use LWP::Simple;
|
||||
|
||||
# homegrown
|
||||
use Moz::Moz;
|
||||
use Moz::Jar;
|
||||
use Moz::BuildFlags;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::CodeWarriorLib;
|
||||
|
||||
# use MozillaBuildList; # eventually, this should go away, and be replaced by data input
|
||||
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
RunBuild
|
||||
);
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// DoPrebuildCheck
|
||||
#//
|
||||
#// Check the build tools etc before running the build.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub DoPrebuildCheck()
|
||||
{
|
||||
SanityCheckBuildOptions();
|
||||
|
||||
# launch codewarrior and persist its location. Have to call this before first
|
||||
# call to getCodeWarriorPath().
|
||||
my($ide_path_file) = $main::filepaths{"idepath"};
|
||||
$ide_path_file = full_path_to($ide_path_file);
|
||||
LaunchCodeWarrior($ide_path_file);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SanityCheckBuildOptions
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SanityCheckBuildOptions()
|
||||
{
|
||||
my($bad_options) = 0;
|
||||
|
||||
# Jar options
|
||||
if (!$main::options{chrome_jars} && !$main::options{chrome_files})
|
||||
{
|
||||
print "Warning: Both \$options{chrome_jars} and \$options{chrome_files} are off. You won't get any chrome.\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if (!$main::options{chrome_jars} && $main::options{use_jars})
|
||||
{
|
||||
print "Warning: \$options{chrome_jars} is off but \$options{use_jars} is on. Your build won't run (expects jars, got files).\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if (!$main::options{chrome_files} && !$main::options{use_jars})
|
||||
{
|
||||
print "Warning: \$options{chrome_jars} is off but \$options{chrome_files} is on. Your build won't run (expects files, got jars).\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if ($main::options{ldap_experimental} && !$main::options{ldap})
|
||||
{
|
||||
print "Warning: \$options{ldap_experimental} is on but \$options{ldap} is off. LDAP experimental features will not be built.\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if ($main::options{wsp} && !$main::options{xmlextras})
|
||||
{
|
||||
print "Warning: \$options{wsp} is on but \$options{xmlextras} is off. wsp will not be built.\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if ($bad_options) {
|
||||
print "Build will start in 5 seconds. Press command-. to stop\n";
|
||||
|
||||
DelayFor(5);
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GenBuildSystemInfo
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub GenBuildSystemInfo()
|
||||
{
|
||||
# always rebuild the configuration program.
|
||||
BuildProjectClean(":mozilla:build:mac:tools:BuildSystemInfo:BuildSystemInfo.mcp", "BuildSystemInfo");
|
||||
|
||||
# delete the configuration file.
|
||||
unlink(":mozilla:build:mac:BuildSystemInfo.pm");
|
||||
|
||||
# run the program.
|
||||
system(":mozilla:build:mac:BuildSystemInfo");
|
||||
|
||||
# wait for the file to be created.
|
||||
while (!(-e ":mozilla:build:mac:BuildSystemInfo.pm")) { WaitNextEvent(); }
|
||||
|
||||
# wait for BuildSystemInfo to finish, so that we see correct results.
|
||||
while (IsProcessRunning("BuildSystemInfo")) { WaitNextEvent(); }
|
||||
|
||||
# now, evaluate the contents of the file.
|
||||
open(F, ":mozilla:build:mac:BuildSystemInfo.pm");
|
||||
while (<F>) { eval; }
|
||||
close(F);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Make library aliases
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub MakeLibAliases()
|
||||
{
|
||||
my($dist_dir) = GetBinDirectory();
|
||||
|
||||
#// ProfilerLib
|
||||
if ($main::PROFILE)
|
||||
{
|
||||
my($profilerlibpath) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:Profiler:Profiler Common:ProfilerLib");
|
||||
MakeAlias("$profilerlibpath", "$dist_dir"."Essential Files:");
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ConfigureBuildSystem
|
||||
#//
|
||||
#// defines some build-system configuration variables.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ConfigureBuildSystem()
|
||||
{
|
||||
#// In the future, we may want to do configurations based on the actual build system itself.
|
||||
#// GenBuildSystemInfo();
|
||||
|
||||
#// For now, if we discover a newer header file than existed in Universal Interfaces 3.2,
|
||||
#// we'll assume that 3.3 or later is in use.
|
||||
my($universal_interfaces) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:Universal:Interfaces:CIncludes:");
|
||||
if (-e ($universal_interfaces . "ControlDefinitions.h")) {
|
||||
$main::UNIVERSAL_INTERFACES_VERSION = 0x0330;
|
||||
}
|
||||
|
||||
#// Rename IC SDK folder in the Mac OS Support folder
|
||||
my($ic_sdk_folder) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:ICProgKit2.0.2");
|
||||
if( -e $ic_sdk_folder)
|
||||
{
|
||||
my($new_ic_folder_name) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:(ICProgKit2.0.2)");
|
||||
rename ($ic_sdk_folder, $new_ic_folder_name);
|
||||
# note that CodeWarrior doesn't descend into folders with () the name
|
||||
print "Mozilla no longer needs the Internet Config SDK to build:\n Renaming the 'ICProgKit2.0.2' folder to '(ICProgKit2.0.2)'\n";
|
||||
}
|
||||
|
||||
printf("UNIVERSAL_INTERFACES_VERSION = 0x%04X\n", $main::UNIVERSAL_INTERFACES_VERSION);
|
||||
|
||||
# alias required CodeWarrior libs into the Essential Files folder (only the Profiler lib now)
|
||||
MakeLibAliases();
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// CheckOutModule. Takes variable number of args; first two are required
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CheckOutModule($$$$)
|
||||
{
|
||||
my($session, $module, $revision, $date) = @_;
|
||||
|
||||
my($result) = $session->checkout($module, $revision, $date);
|
||||
|
||||
# result of 1 is success
|
||||
if ($result) { return; }
|
||||
|
||||
my($checkout_err) = $session->getLastError();
|
||||
if ($checkout_err == 708) {
|
||||
die "Error: Checkout was cancelled.\n";
|
||||
} elsif ($checkout_err == 911) {
|
||||
die "Error: CVS session settings are incorrect. Check your password, and the CVS root settings.\n";
|
||||
} elsif ($checkout_err == 703) {
|
||||
die "Error: CVS checkout failed. Unknown module, unknown tag, bad username, or other CVS error.\n";
|
||||
} elsif ($checkout_err == 711) {
|
||||
print "Checkout of '$module' failed.\n";
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getScriptFolder
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getScriptFolder()
|
||||
{
|
||||
return dirname($0);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getScriptFolder
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub get_url_contents($)
|
||||
{
|
||||
my($url) = @_;
|
||||
|
||||
my($url_contents) = LWP::Simple::get($url);
|
||||
$url_contents =~ s/\r\n/\n/g; # normalize linebreaks
|
||||
$url_contents =~ s/\r/\n/g; # normalize linebreaks
|
||||
return $url_contents;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// get_files_from_content
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub uniq
|
||||
{
|
||||
my $lastval;
|
||||
grep(($_ ne $lastval, $lastval = $_)[$[], @_);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// get_files_from_content
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub get_files_from_content($)
|
||||
{
|
||||
my($content) = @_;
|
||||
|
||||
my(@jscalls) = grep (/return js_file_menu[^{]*/, split(/\n/, $content));
|
||||
my $i;
|
||||
|
||||
for ($i = 0; $i < @jscalls ; $i++)
|
||||
{
|
||||
$jscalls[$i] =~ s/.*\(|\).*//g;
|
||||
my(@callparams) = split(/,/, $jscalls[$i]);
|
||||
my ($repos, $dir, $file, $rev) = grep(s/['\s]//g, @callparams);
|
||||
$jscalls[$i] = "$dir/$file";
|
||||
}
|
||||
|
||||
&uniq(sort(@jscalls));
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getLastUpdateTime
|
||||
#//
|
||||
#// Get the last time we updated. Return 0 on failure
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getLastUpdateTime($)
|
||||
{
|
||||
my($timestamp_file) = @_;
|
||||
|
||||
my($time_string);
|
||||
|
||||
local(*TIMESTAMP_FILE);
|
||||
unless (open(TIMESTAMP_FILE, "< $timestamp_file")) { return 0; }
|
||||
|
||||
while (<TIMESTAMP_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# ignore comments and empty lines
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
|
||||
next;
|
||||
}
|
||||
|
||||
$time_string = $line;
|
||||
}
|
||||
|
||||
# get the epoch seconds
|
||||
my($last_update_secs) = $time_string;
|
||||
$last_update_secs =~ s/\s#.+$//;
|
||||
|
||||
print "FAST_UPDATE found that you last updated at ".localtime($last_update_secs)."\n";
|
||||
|
||||
# how long ago was this, in hours?
|
||||
my($gm_now) = time();
|
||||
my($update_hours) = 1 + ceil(($gm_now - $last_update_secs) / (60 * 60));
|
||||
|
||||
return $update_hours;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// saveCheckoutTimestamp
|
||||
#//
|
||||
#// Create a file on disk containing the current time. Param is time(), which is an Epoch seconds
|
||||
#// (and therefore in GMT).
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub saveCheckoutTimestamp($$)
|
||||
{
|
||||
my($gm_secs, $timestamp_file) = @_;
|
||||
|
||||
local(*TIMESTAMP_FILE);
|
||||
open(TIMESTAMP_FILE, ">$timestamp_file") || die "Failed to open $timestamp_file\n";
|
||||
print(TIMESTAMP_FILE "# time of last checkout or update, in GMT. Used by FAST_UPDATE\n");
|
||||
print(TIMESTAMP_FILE "$gm_secs \# around ".localtime()." local time\n");
|
||||
close(TIMESTAMP_FILE);
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// FastUpdate
|
||||
#//
|
||||
#// Use Bonsai url data to update only those dirs which have new files
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub FastUpdate($$)
|
||||
{
|
||||
my($modules, $timestamp_file) = @_; # list of modules to check out
|
||||
|
||||
my($num_hours) = getLastUpdateTime($timestamp_file);
|
||||
if ($num_hours == 0 || $num_hours > 170) {
|
||||
print "Can't fast_update; last update was too long ago, or never. Doing normal checkout.\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
print "Doing fast update, pulling files changed in the last $num_hours hours\n";
|
||||
|
||||
my($cvsfile) = AskAndPersistFile($main::filepaths{"sessionpath"});
|
||||
my($session) = Moz::MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
# activate MacCVS
|
||||
ActivateApplication('Mcvs');
|
||||
|
||||
my($checkout_start_time) = time();
|
||||
|
||||
#print "Time now is $checkout_start_time ($checkout_start_time + 0)\n";
|
||||
|
||||
my($this_co);
|
||||
foreach $this_co (@$modules)
|
||||
{
|
||||
my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]);
|
||||
|
||||
# assume that things pulled by date wont change
|
||||
if ($date ne "") {
|
||||
print "$module is pulled by date, so ignoring in FastUpdate.\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my($search_type) = "hours";
|
||||
my($min_date) = "";
|
||||
my($max_date) = "";
|
||||
my($url) = "http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=${module}&branch=${revision}&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=${num_hours}&date=${search_type}&mindate=${min_date}&maxdate=${max_date}&cvsroot=%2Fcvsroot";
|
||||
|
||||
if ($revision eq "") {
|
||||
print "Getting list of checkins to $module from Bonsai...\n";
|
||||
} else {
|
||||
print "Getting list of checkins to $module on branch $revision from Bonsai...\n";
|
||||
}
|
||||
my(@files) = &get_files_from_content(&get_url_contents($url));
|
||||
|
||||
if ($#files > 0)
|
||||
{
|
||||
my(@cvs_co_list);
|
||||
|
||||
my($co_file);
|
||||
foreach $co_file (@files)
|
||||
{
|
||||
print "Updating $co_file\n";
|
||||
push(@cvs_co_list, $co_file);
|
||||
}
|
||||
|
||||
my($result) = $session->update($revision, \@cvs_co_list);
|
||||
# result of 1 is success
|
||||
if (!$result) { die "Error: Fast update failed\n"; }
|
||||
} else {
|
||||
print "No files in this module changed\n";
|
||||
}
|
||||
}
|
||||
|
||||
saveCheckoutTimestamp($checkout_start_time, $timestamp_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Checkout
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CheckoutModules($$$)
|
||||
{
|
||||
my($modules, $pull_date, $timestamp_file) = @_; # list of modules to check out
|
||||
|
||||
my($start_time) = TimeStart();
|
||||
|
||||
# assertRightDirectory();
|
||||
my($cvsfile) = AskAndPersistFile($main::filepaths{"sessionpath"});
|
||||
my($session) = Moz::MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
my($checkout_start_time) = time();
|
||||
|
||||
# activate MacCVS
|
||||
ActivateApplication('Mcvs');
|
||||
|
||||
my($this_co);
|
||||
foreach $this_co (@$modules)
|
||||
{
|
||||
my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]);
|
||||
if ($date eq "") {
|
||||
$date = $pull_date;
|
||||
}
|
||||
CheckOutModule($session, $module, $revision, $date);
|
||||
# print "Checking out $module with ref $revision, date $date\n";
|
||||
}
|
||||
|
||||
saveCheckoutTimestamp($checkout_start_time, $timestamp_file);
|
||||
TimeEnd($start_time, "Checkout");
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ReadCheckoutModulesFile
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ReadCheckoutModulesFile($$)
|
||||
{
|
||||
my($modules_file, $co_list) = @_;
|
||||
|
||||
my($checkout_file) = getScriptFolder().":".$modules_file;
|
||||
local(*CHECKOUT_FILE);
|
||||
open(CHECKOUT_FILE, "< $checkout_file") || die "Error: failed to open checkout list $checkout_file\n";
|
||||
while (<CHECKOUT_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# ignore comments and empty lines
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
|
||||
next;
|
||||
}
|
||||
|
||||
my(@cvs_co) = ["", "", ""];
|
||||
|
||||
my($module, $revision, $date) = (0, 1, 2);
|
||||
|
||||
if ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*\,\s*([^#]+)/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$revision] = $2;
|
||||
@cvs_co[$date] = $3;
|
||||
}
|
||||
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*(#.+)?/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$revision] = $2;
|
||||
}
|
||||
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*,\s*([^#,]+)/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$date] = $2;
|
||||
}
|
||||
elsif ($line =~ /\s*([^#,\s]+)/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: unrecognized line '$line' in $modules_file\n";
|
||||
}
|
||||
|
||||
# strip surrounding space from date
|
||||
@cvs_co[$date] =~ s/^\s*|\s*$//g;
|
||||
|
||||
# print "Going to check out '@cvs_co[$module]', '@cvs_co[$revision]', '@cvs_co[$date]'\n";
|
||||
push(@$co_list, \@cvs_co);
|
||||
}
|
||||
|
||||
close(CHECKOUT_FILE);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// PullFromCVS
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub PullFromCVS($$)
|
||||
{
|
||||
unless ( $main::build{pull} ) { return; }
|
||||
|
||||
my($modules_file, $timestamp_file) = @_;
|
||||
|
||||
StartBuildModule("pull");
|
||||
|
||||
my(@cvs_co_list);
|
||||
ReadCheckoutModulesFile($modules_file, \@cvs_co_list);
|
||||
|
||||
if ($main::FAST_UPDATE && $main::options{pull_by_date})
|
||||
{
|
||||
die "Error: you can't use FAST_UPDATE if you are pulling by date.\n";
|
||||
}
|
||||
|
||||
my($did_fast_update) = $main::FAST_UPDATE && FastUpdate(\@cvs_co_list, $timestamp_file);
|
||||
if (!$did_fast_update)
|
||||
{
|
||||
my($pull_date) = "";
|
||||
if ($main::options{pull_by_date})
|
||||
{
|
||||
# acceptable CVS date formats are (in local time):
|
||||
# ISO8601 (e.g. "1972-09-24 20:05") and Internet (e.g. "24 Sep 1972 20:05").
|
||||
# Perl's localtime() string format also seems to work.
|
||||
$pull_date = localtime().""; # force string interp.
|
||||
print "Pulling by date $pull_date\n";
|
||||
}
|
||||
|
||||
CheckoutModules(\@cvs_co_list, $pull_date, $timestamp_file);
|
||||
}
|
||||
|
||||
EndBuildModule("pull");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RunBuild
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RunBuild($$$$)
|
||||
{
|
||||
my($do_pull, $do_build, $input_files, $build_prefs) = @_;
|
||||
|
||||
InitBuildProgress($input_files->{"buildprogress"});
|
||||
|
||||
# if we are pulling, we probably want to do a full build, so clear the build progress
|
||||
if ($do_pull) {
|
||||
ClearBuildProgress();
|
||||
}
|
||||
|
||||
# read local prefs, and the build progress file, and set flags to say what to build
|
||||
SetupBuildParams(\%main::build,
|
||||
\%main::options,
|
||||
\%main::optiondefines,
|
||||
\%main::filepaths,
|
||||
$input_files->{"buildflags"},
|
||||
$build_prefs);
|
||||
|
||||
# If we were told to pull, make sure we do, overriding prefs etc.
|
||||
if ($do_pull)
|
||||
{
|
||||
$main::build{"pull"} = 1;
|
||||
}
|
||||
|
||||
# transfer this flag
|
||||
$CodeWarriorLib::CLOSE_PROJECTS_FIRST = $main::CLOSE_PROJECTS_FIRST;
|
||||
|
||||
# setup the build log
|
||||
SetupBuildLog($main::filepaths{"buildlogfilepath"}, $main::USE_TIMESTAMPED_LOGS);
|
||||
StopForErrors();
|
||||
|
||||
if ($main::LOG_TO_FILE) {
|
||||
RedirectOutputToFile($main::filepaths{"scriptlogfilepath"});
|
||||
}
|
||||
|
||||
# run a pre-build check to see that the tools etc are in order
|
||||
DoPrebuildCheck();
|
||||
|
||||
# do the pull
|
||||
PullFromCVS($input_files->{"checkoutdata"}, $input_files->{"checkouttime"});
|
||||
|
||||
unless ($do_build) { return; }
|
||||
|
||||
my($build_start) = TimeStart();
|
||||
|
||||
# check the build environment
|
||||
ConfigureBuildSystem();
|
||||
|
||||
# here we load and call methods in the build module indirectly.
|
||||
# we have to use indirection because the build module can be named
|
||||
# differently for different builds.
|
||||
chdir(dirname($0)); # change to the script dir
|
||||
my($build_module) = $input_files->{"buildmodule"};
|
||||
# load the build module
|
||||
require $build_module;
|
||||
{ # scope for no strict 'refs'
|
||||
no strict 'refs';
|
||||
|
||||
my($package_name) = $build_module;
|
||||
$package_name =~ s/\.pm$//;
|
||||
|
||||
chdir($main::MOZ_SRC);
|
||||
&{$package_name."::BuildDist"}();
|
||||
|
||||
chdir($main::MOZ_SRC);
|
||||
&{$package_name."::BuildProjects"}();
|
||||
}
|
||||
|
||||
# the build finished, so clear the build progress state
|
||||
ClearBuildProgress();
|
||||
|
||||
TimeEnd($build_start, "Build");
|
||||
print "Build complete\n";
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -1,425 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::BuildFlags;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that attempts to read a file from the Preferences folder,
|
||||
# and get build settings out of it
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use Moz::Moz;
|
||||
use Moz::Prefs;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
SetupBuildParams
|
||||
InitBuildProgress
|
||||
WriteBuildProgress
|
||||
ClearBuildProgress
|
||||
ReadBuildProgress
|
||||
);
|
||||
|
||||
|
||||
my(@build_flags);
|
||||
my(@options_flags);
|
||||
my(@filepath_flags);
|
||||
|
||||
my(%arrays_list) = (
|
||||
"build_flags", \@build_flags,
|
||||
"options_flags", \@options_flags,
|
||||
"filepath_flags", \@filepath_flags
|
||||
);
|
||||
|
||||
my($progress_file) = "¥ÊBuild progress";
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# appendArrayFlag
|
||||
#
|
||||
# Set a flag in the array
|
||||
#-------------------------------------------------------------------------------
|
||||
sub appendArrayFlag(@)
|
||||
{
|
||||
my($array_name) = shift;
|
||||
my($setting) = shift;
|
||||
my($value) = shift;
|
||||
|
||||
my(@optional_values);
|
||||
foreach (@_) {
|
||||
push(@optional_values, $_);
|
||||
}
|
||||
|
||||
my(@this_flag) = [$setting, $value, @optional_values];
|
||||
my($flags_array) = $arrays_list{$array_name};
|
||||
if ($flags_array)
|
||||
{
|
||||
push(@{$flags_array}, @this_flag) || die "Failed to append\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: unknown build flags array $array_name\n";
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# readFlagsFile
|
||||
#
|
||||
# Read the file of build flags from disk. File path is relative to the
|
||||
# script directory.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub readFlagsFile($)
|
||||
{
|
||||
my($flags_file) = @_;
|
||||
|
||||
my($file_path) = $0;
|
||||
$file_path =~ s/[^:]+$/$flags_file/;
|
||||
|
||||
print "Reading build flags from '$file_path'\n";
|
||||
|
||||
local(*FLAGS_FILE);
|
||||
open(FLAGS_FILE, "< $file_path") || die "Error: failed to open flags file $file_path\n";
|
||||
|
||||
my($cur_array) = "";
|
||||
|
||||
while(<FLAGS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# ignore comments and empty lines
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
|
||||
next;
|
||||
}
|
||||
|
||||
# 1-word line, probably array name
|
||||
if ($line =~ /^([^#\s]+)\s*$/)
|
||||
{
|
||||
$cur_array = $1;
|
||||
next;
|
||||
}
|
||||
elsif ($line =~ /^([^#\s]+)\s+\"(.+)\"(\s+#.+)?$/) # quoted option, possible comment
|
||||
{
|
||||
my($flag) = $1;
|
||||
my($setting) = $2;
|
||||
|
||||
appendArrayFlag($cur_array, $flag, $setting);
|
||||
}
|
||||
elsif ($line =~ /^([^#\s]+)((\s+[^#\s]+)+)(\s+#.+)?$/) # multiple word line, possible comment
|
||||
{
|
||||
my($flag) = $1;
|
||||
|
||||
appendArrayFlag($cur_array, $flag, split(' ', $2));
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: unknown build flag at '$line'\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(FLAGS_FILE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# flagsArrayToHash
|
||||
#
|
||||
# Utility routine to migrate flag from a 2D array to a hash, where
|
||||
# item[n][0] is the hash entry name, and item[n][1] is the hash entry value.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub flagsArrayToHash($$)
|
||||
{
|
||||
my($src_array, $dest_hash) = @_;
|
||||
|
||||
my($item);
|
||||
foreach $item (@$src_array)
|
||||
{
|
||||
$dest_hash->{$item->[0]} = $item->[1];
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------
|
||||
# printHash
|
||||
#
|
||||
# Utility routine to print a hash
|
||||
#-----------------------------------------------
|
||||
sub printHash($)
|
||||
{
|
||||
my($hash_ref) = @_;
|
||||
|
||||
print "Printing hash:\n";
|
||||
|
||||
my($key, $value);
|
||||
|
||||
while (($key, $value) = each (%$hash_ref))
|
||||
{
|
||||
print " $key $value\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------
|
||||
# printBuildArray
|
||||
#
|
||||
# Utility routine to print a 2D array
|
||||
#-----------------------------------------------
|
||||
sub printBuildArray($)
|
||||
{
|
||||
my($build_array) = @_;
|
||||
|
||||
my($entry);
|
||||
foreach $entry (@$build_array)
|
||||
{
|
||||
print "$entry->[0] = $entry->[1]\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetBuildFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetBuildFlags($)
|
||||
{
|
||||
my($build) = @_;
|
||||
|
||||
flagsArrayToHash(\@build_flags, $build);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetBuildOptions
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetBuildOptions($)
|
||||
{
|
||||
my($options) = @_;
|
||||
|
||||
flagsArrayToHash(\@options_flags, $options);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetFilepathFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetFilepathFlags($)
|
||||
{
|
||||
my($filepath) = @_;
|
||||
|
||||
flagsArrayToHash(\@filepath_flags, $filepath);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetOptionDefines
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetOptionDefines($)
|
||||
{
|
||||
my($optiondefines) = @_;
|
||||
|
||||
foreach my $entry (@options_flags)
|
||||
{
|
||||
if (defined($entry->[2])) {
|
||||
$optiondefines->{$entry->[0]}{$entry->[2]} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# PropagateAllFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub PropagateAllFlags($)
|
||||
{
|
||||
my($build_array) = @_;
|
||||
|
||||
# if "all" is set, set all the flags to 1
|
||||
unless ($build_array->[0][0] eq "all") { die "Error: 'all' must come first in the flags array\n"; }
|
||||
|
||||
if ($build_array->[0][1] == 1)
|
||||
{
|
||||
my($index);
|
||||
foreach $index (@$build_array)
|
||||
{
|
||||
$index->[1] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// _getBuildProgressFile
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub _getBuildProgressFile()
|
||||
{
|
||||
return $progress_file;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// setBuildProgressStart
|
||||
#//
|
||||
#// This automagically sets $build{"all"} to 0
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub setBuildProgressStart($$)
|
||||
{
|
||||
my($build_array, $name) = @_;
|
||||
|
||||
my($index);
|
||||
foreach $index (@$build_array)
|
||||
{
|
||||
$index->[1] = 0;
|
||||
if ($index->[0] eq $name) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
print "Building from module after $name, as specified by build progress\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// InitBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub InitBuildProgress($)
|
||||
{
|
||||
my($prog_file) = @_;
|
||||
if ($prog_file ne "") {
|
||||
$progress_file = full_path_to($prog_file);
|
||||
print "Writing build progress to $progress_file\n";
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// WriteBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub WriteBuildProgress($)
|
||||
{
|
||||
my($module_built) = @_;
|
||||
|
||||
my($progress_file) = _getBuildProgressFile();
|
||||
|
||||
if ($progress_file ne "")
|
||||
{
|
||||
open(PROGRESS_FILE, ">>$progress_file") || die "Failed to open $progress_file\n";
|
||||
print(PROGRESS_FILE "$module_built\n");
|
||||
close(PROGRESS_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ClearBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ClearBuildProgress()
|
||||
{
|
||||
my($progress_file) = _getBuildProgressFile();
|
||||
if ($progress_file ne "") {
|
||||
unlink $progress_file;
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// WipeBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub WipeBuildProgress()
|
||||
{
|
||||
print "Ignoring build progress\n";
|
||||
ClearBuildProgress();
|
||||
$progress_file = "";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ReadBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ReadBuildProgress($)
|
||||
{
|
||||
my($build_array) = @_;
|
||||
my($progress_file) = _getBuildProgressFile();
|
||||
|
||||
my($last_module);
|
||||
|
||||
if (open(PROGRESS_FILE, "< $progress_file"))
|
||||
{
|
||||
print "Getting build progress from $progress_file\n";
|
||||
|
||||
while (<PROGRESS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
$last_module = $line;
|
||||
}
|
||||
|
||||
close(PROGRESS_FILE);
|
||||
}
|
||||
|
||||
if ($last_module)
|
||||
{
|
||||
setBuildProgressStart($build_array, $last_module);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# clearOldBuildSettings
|
||||
#-------------------------------------------------------------------------------
|
||||
sub clearOldBuildSettings($$$$)
|
||||
{
|
||||
my($build, $options, $optiondefines, $filepaths) = @_;
|
||||
|
||||
# empty the arrays in case we're being called twice
|
||||
@build_flags = ();
|
||||
@options_flags = ();
|
||||
@filepath_flags = ();
|
||||
|
||||
# and empty the hashes
|
||||
%$build = ();
|
||||
%$options = ();
|
||||
%$optiondefines = ();
|
||||
%$filepaths = ();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetupBuildParams
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetupBuildParams($$$$$$)
|
||||
{
|
||||
my($build, $options, $optiondefines, $filepaths, $flags_file, $prefs_file) = @_;
|
||||
|
||||
# Empty the hashes and arrays, to wipe out any stale data.
|
||||
# Needed because these structures persist across two build scripts
|
||||
# called using 'do' from a parent script.
|
||||
clearOldBuildSettings($build, $options, $optiondefines, $filepaths);
|
||||
|
||||
# Read from the flags file, which sets up the various arrays
|
||||
readFlagsFile($flags_file);
|
||||
|
||||
# If 'all' is set in the build array, propagate that to all entries
|
||||
PropagateAllFlags(\@build_flags);
|
||||
|
||||
# read the user pref file, that can change values in the array
|
||||
ReadMozUserPrefs($prefs_file, \@build_flags, \@options_flags, \@filepath_flags);
|
||||
|
||||
# If build progress exists, this clears flags in the array up to a certain point
|
||||
if ($main::USE_BUILD_PROGRESS) {
|
||||
ReadBuildProgress(\@build_flags);
|
||||
} else {
|
||||
WipeBuildProgress();
|
||||
}
|
||||
|
||||
# printBuildArray(\@build_flags);
|
||||
# printBuildArray(\@options_flags);
|
||||
|
||||
SetBuildFlags($build);
|
||||
SetBuildOptions($options);
|
||||
SetOptionDefines($optiondefines);
|
||||
SetFilepathFlags($filepaths);
|
||||
|
||||
# printHash($build);
|
||||
# printHash($options);
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
@@ -1,786 +0,0 @@
|
||||
|
||||
package Moz::BuildUtils;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that contains build util functions specific to the Mozilla build
|
||||
# process.
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use Cwd;
|
||||
use File::Path;
|
||||
use File::Basename;
|
||||
|
||||
use Mac::Events;
|
||||
use Mac::StandardFile;
|
||||
|
||||
use Moz::Moz;
|
||||
use Moz::BuildFlags;
|
||||
use Moz::MacCVS;
|
||||
#use Moz::ProjectXML; #optional; required for static build only
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
SetupDefaultBuildOptions
|
||||
SetupBuildRootDir
|
||||
StartBuildModule
|
||||
EndBuildModule
|
||||
GetBinDirectory
|
||||
BuildOneProjectWithOutput
|
||||
BuildOneProject
|
||||
BuildProject
|
||||
BuildProjectClean
|
||||
BuildIDLProject
|
||||
BuildFolderResourceAliases
|
||||
AskAndPersistFile
|
||||
DelayFor
|
||||
TimeStart
|
||||
TimeEnd
|
||||
EmptyTree
|
||||
SetupBuildLog
|
||||
SetBuildNumber
|
||||
SetTimeBomb
|
||||
UpdateConfigHeader
|
||||
);
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetupDefaultBuildOptions
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetupDefaultBuildOptions($$$)
|
||||
{
|
||||
my($debug, $bin_dir, $config_header_file_name) = @_;
|
||||
|
||||
# Here we set up defaults for the various build flags.
|
||||
# If you want to override any of these, it's best to do
|
||||
# so via the relevant preferences file, which lives in
|
||||
# System Folder:Preferences:Mozilla build prefs:{build prefs file}.
|
||||
# For the name of the prefs file, see the .pl script that you
|
||||
# run to start this build. The prefs files are created when
|
||||
# you run the build, and contain some documentation.
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# configuration variables that globally affect what is built
|
||||
#-------------------------------------------------------------
|
||||
$main::DEBUG = $debug;
|
||||
$main::PROFILE = 0;
|
||||
$main::RUNTIME = 0; # turn on to just build runtime support and NSPR projects
|
||||
$main::GC_LEAK_DETECTOR = 0; # turn on to use GC leak detection
|
||||
$main::MOZILLA_OFFICIAL = 0; # generate build number
|
||||
$main::LOG_TO_FILE = 0; # write perl output to a file
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# configuration variables that affect the manner of building,
|
||||
# but possibly affecting the outcome.
|
||||
#-------------------------------------------------------------
|
||||
$main::ALIAS_SYM_FILES = $main::DEBUG;
|
||||
$main::CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before
|
||||
# building each project
|
||||
# The following two options will delete all dist files (if you have $main::build{dist} turned on),
|
||||
# but leave the directory structure intact.
|
||||
$main::CLOBBER_DIST_ALL = 1; # turn on to clobber all aliases/files inside dist (headers/xsym/libs)
|
||||
$main::CLOBBER_DIST_LIBS = 0; # turn on to clobber only aliases/files for libraries/sym files in dist
|
||||
$main::CLOBBER_IDL_PROJECTS = 0; # turn on to clobber all IDL projects.
|
||||
$main::CLOBBER_PROJECTS = 0; # turn on to remove object code from each project before building it
|
||||
|
||||
$main::UNIVERSAL_INTERFACES_VERSION = 0x0320;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# configuration variables that are preferences for the build,
|
||||
# style and do not affect what is built.
|
||||
#-------------------------------------------------------------
|
||||
$main::CLOSE_PROJECTS_FIRST = 0;
|
||||
# 1 = close then make (for development),
|
||||
# 0 = make then close (for tinderbox).
|
||||
$main::USE_TIMESTAMPED_LOGS = 0;
|
||||
$main::USE_BUILD_PROGRESS = 1; # track build progress for restartable builds
|
||||
#-------------------------------------------------------------
|
||||
# END OF CONFIG SWITCHES
|
||||
#-------------------------------------------------------------
|
||||
|
||||
$main::BIN_DIRECTORY = $bin_dir;
|
||||
$main::DEFINESOPTIONS_FILE = $config_header_file_name;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetupBuildRootDir
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetupBuildRootDir($)
|
||||
{
|
||||
my($rel_path_to_script) = @_;
|
||||
|
||||
my($cur_dir) = cwd();
|
||||
$cur_dir =~ s/$rel_path_to_script$//;
|
||||
chdir($cur_dir) || die "Error: failed to set build root directory to '$cur_dir'.\nYou probably need to put 'mozilla' one level down (in a folder).\n";
|
||||
$main::MOZ_SRC = cwd();
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// StartBuildModule
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub StartBuildModule($)
|
||||
{
|
||||
my($module) = @_;
|
||||
|
||||
print("---- Start of $module ----\n");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// EndBuildModule
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub EndBuildModule($)
|
||||
{
|
||||
my($module) = @_;
|
||||
WriteBuildProgress($module);
|
||||
print("---- End of $module ----\n");
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# GetBinDirectory
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub GetBinDirectory()
|
||||
{
|
||||
if ($main::BIN_DIRECTORY eq "") { die "Dist directory not set\n"; }
|
||||
return $main::BIN_DIRECTORY;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# AskAndPersistFile stores the information about the user pick inside
|
||||
# the file $session_storage
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub AskAndPersistFile($)
|
||||
{
|
||||
my ($sessionStorage) = @_;
|
||||
my $cvsfile;
|
||||
|
||||
if (( -e $sessionStorage) &&
|
||||
open( SESSIONFILE, $sessionStorage ))
|
||||
{
|
||||
# Read in the path if available
|
||||
$cvsfile = <SESSIONFILE>;
|
||||
chomp $cvsfile;
|
||||
close SESSIONFILE;
|
||||
if ( ! -e $cvsfile )
|
||||
{
|
||||
print STDERR "$cvsfile has disappeared\n";
|
||||
undef $cvsfile;
|
||||
}
|
||||
}
|
||||
unless (defined ($cvsfile))
|
||||
{
|
||||
# make sure that MacPerl is a front process
|
||||
ActivateApplication('McPL');
|
||||
MacPerl::Answer("Could not find your MacCVS session file. Please choose one", "OK");
|
||||
|
||||
# prompt user for the file name, and store it
|
||||
my $macFile = StandardGetFile( 0, "McvD");
|
||||
if ( $macFile->sfGood() )
|
||||
{
|
||||
$cvsfile = $macFile->sfFile();
|
||||
# save the choice if we can
|
||||
if ( open (SESSIONFILE, ">" . $sessionStorage))
|
||||
{
|
||||
printf SESSIONFILE $cvsfile, "\n";
|
||||
close SESSIONFILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "Could not open storage file $sessionStorage for saving $cvsfile\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $cvsfile;
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# BuildIDLProject
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildIDLProject($$)
|
||||
{
|
||||
my ($project_path, $module_name) = @_;
|
||||
|
||||
if ($main::CLOBBER_IDL_PROJECTS)
|
||||
{
|
||||
my (@suffix_list) = (".mcp", ".xml");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
|
||||
if ($suffix eq "") { die "Error: Project, $project_path must end in .xml or .mcp\n"; }
|
||||
|
||||
my($datafolder_path);
|
||||
if ($suffix eq ".xml")
|
||||
{
|
||||
$datafolder_path = $project_dir . "_" . $project_name . " Data:";
|
||||
}
|
||||
else {
|
||||
$datafolder_path = $project_dir . $project_name . " Data:";
|
||||
}
|
||||
|
||||
print STDERR "Deleting IDL data folder: $datafolder_path\n";
|
||||
EmptyTree($datafolder_path);
|
||||
}
|
||||
|
||||
BuildOneProject($project_path, "headers", 0, 0, 0);
|
||||
BuildOneProject($project_path, $module_name.".xpt", 1, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# CreateStaticLibTargets
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub CreateXMLStaticLibTargets($)
|
||||
{
|
||||
my($xml_path) = @_;
|
||||
|
||||
my (@suffix_list) = (".xml");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($xml_path, @suffix_list);
|
||||
if ($suffix eq "") { die "XML munging: $xml_path must end in .xml\n"; }
|
||||
|
||||
#sniff the file to see if we need to fix up broken Pro5-exported XML
|
||||
print "Parsing $xml_path\n";
|
||||
|
||||
my $ide_version = Moz::ProjectXML::SniffProjectXMLIDEVersion($xml_path);
|
||||
if ($ide_version eq "4.0")
|
||||
{
|
||||
my $new_file = $project_dir.$project_name."2.xml";
|
||||
|
||||
print "Cleaning up Pro 5 xml to $new_file\n";
|
||||
|
||||
Moz::ProjectXML::CleanupPro5XML($xml_path, $new_file);
|
||||
|
||||
unlink $xml_path;
|
||||
rename ($new_file, $xml_path);
|
||||
}
|
||||
|
||||
my $doc = Moz::ProjectXML::ParseXMLDocument($xml_path);
|
||||
my @target_list = Moz::ProjectXML::GetTargetsList($doc);
|
||||
my $target;
|
||||
|
||||
my %target_hash; # for easy lookups below
|
||||
foreach $target (@target_list) { $target_hash{$target} = 1; }
|
||||
|
||||
foreach $target (@target_list)
|
||||
{
|
||||
if ($target =~ /(.+).shlb$/) # if this is a shared lib target
|
||||
{
|
||||
my $target_base = $1;
|
||||
my $static_target = $target_base.".o";
|
||||
|
||||
# ensure that this does not exist already
|
||||
if ($target_hash{$static_target}) {
|
||||
print "Static target $static_target already exists in project. Not making\n";
|
||||
next;
|
||||
}
|
||||
|
||||
print "Making static target '$static_target' from target '$target'\n";
|
||||
|
||||
Moz::ProjectXML::CloneTarget($doc, $target, $static_target);
|
||||
Moz::ProjectXML::SetAsStaticLibraryTarget($doc, $static_target, $static_target);
|
||||
}
|
||||
}
|
||||
|
||||
print "Writing XML file to $xml_path\n";
|
||||
my $temp_path = $project_dir."_".$project_name.".xml";
|
||||
Moz::ProjectXML::WriteXMLDocument($doc, $temp_path, $ide_version);
|
||||
Moz::ProjectXML::DisposeXMLDocument($doc);
|
||||
|
||||
if (-e $temp_path)
|
||||
{
|
||||
unlink $xml_path;
|
||||
rename ($temp_path, $xml_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: Failed to add new targets to XML project\n";
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ProcessProjectXML
|
||||
#//
|
||||
#// Helper routine to allow for XML pre-processing. This should read in the XML, process it,
|
||||
#// and replace the original file with the processed version.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ProcessProjectXML($)
|
||||
{
|
||||
my($xml_path) = @_;
|
||||
|
||||
# we need to manually load Moz::ProjectXML, becaues not everyone will have the
|
||||
# required perl modules in their distro.
|
||||
my($cur_dir) = cwd();
|
||||
|
||||
chdir(dirname($0)); # change to the script dir
|
||||
eval "require Moz::ProjectXML";
|
||||
if ($@) { die "Error: could not do Project XML munging because you do not have the correct XML modules installed. Error is:\n################\n $@################"; }
|
||||
|
||||
chdir($cur_dir);
|
||||
|
||||
CreateXMLStaticLibTargets($xml_path);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build one project, and make the alias. Parameters are project path, target name, shared library
|
||||
#// name, make shlb alias (boolean), make xSYM alias (boolean), and is component (boolean).
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildOneProjectWithOutput($$$$$$)
|
||||
{
|
||||
my ($project_path, $target_name, $output_name, $alias_lib, $alias_xSYM, $component) = @_;
|
||||
|
||||
unless ($project_path =~ m/^$main::BUILD_ROOT.+/) { return; }
|
||||
|
||||
my (@suffix_list) = (".mcp", ".xml");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
|
||||
if ($suffix eq "") { die "Error: Project, $project_path must end in .xml or .mcp\n"; }
|
||||
|
||||
my($dist_dir) = GetBinDirectory();
|
||||
|
||||
# Put libraries in "Essential Files" folder, Components in "Components" folder
|
||||
my($output_dir) = $component ? "Components:" : "Essential Files:";
|
||||
my($output_path) = $dist_dir.$output_dir;
|
||||
|
||||
if ($main::options{static_build})
|
||||
{
|
||||
if ($output_name =~ /\.o$/ || $output_name =~ /\.[Ll]ib$/)
|
||||
{
|
||||
$alias_xSYM = 0;
|
||||
$alias_lib = 1;
|
||||
$output_path = $main::DEBUG ? ":mozilla:dist:static_libs_debug:" : ":mozilla:dist:static_libs:";
|
||||
}
|
||||
}
|
||||
|
||||
# if the flag is on to export projects to XML, export and munge them
|
||||
if ($main::EXPORT_PROJECTS && !($project_path =~ /IDL\.mcp$/))
|
||||
{
|
||||
my $xml_out_path = $project_path;
|
||||
|
||||
$xml_out_path =~ s/\.mcp$/\.xml/;
|
||||
|
||||
# only do this if project is newer?
|
||||
if (! -e $xml_out_path)
|
||||
{
|
||||
ExportProjectToXML(full_path_to($project_path), full_path_to($xml_out_path));
|
||||
ProcessProjectXML($xml_out_path);
|
||||
}
|
||||
}
|
||||
|
||||
# if the flag is set to use XML projects, default to XML if the file
|
||||
# is present.
|
||||
if ($main::USE_XML_PROJECTS && !($project_path =~ /IDL\.mcp$/))
|
||||
{
|
||||
my $xml_project_path = $project_dir.$project_name.".xml";
|
||||
if (-e $xml_project_path)
|
||||
{
|
||||
$project_path = $xml_project_path;
|
||||
$suffix = ".xml";
|
||||
}
|
||||
}
|
||||
|
||||
if ($suffix eq ".xml")
|
||||
{
|
||||
my($xml_path) = $project_path;
|
||||
# Prepend an "_" onto the name of the generated project file so it doesn't conflict
|
||||
$project_path = $project_dir . "_" . $project_name . ".mcp";
|
||||
my($project_modtime) = (-e $project_path ? GetFileModDate($project_path) : 0);
|
||||
my($xml_modtime) = (-e $xml_path ? GetFileModDate($xml_path) : 0);
|
||||
|
||||
if ($xml_modtime > $project_modtime)
|
||||
{
|
||||
print("Importing $project_path from $project_name.xml.\n");
|
||||
unlink($project_path);
|
||||
# Might want to delete the "xxx.mcp Data" dir ???
|
||||
ImportXMLProject(full_path_to($xml_path), full_path_to($project_path));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($main::CLOBBER_LIBS)
|
||||
{
|
||||
unlink "$project_dir$output_name"; # it's OK if these fail
|
||||
unlink "$project_dir$output_name.xSYM";
|
||||
}
|
||||
|
||||
DoBuildProject($project_path, $target_name, $main::CLOBBER_PROJECTS);
|
||||
|
||||
$alias_lib ? MakeAlias("$project_dir$output_name", "$output_path") : 0;
|
||||
$alias_xSYM ? MakeAlias("$project_dir$output_name.xSYM", "$output_path") : 0;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// For compatiblity with existing scripts, BuildOneProject now just calls
|
||||
#// BuildOneProjectWithOutput, with the output name and target name identical.
|
||||
#// Note that this routine assumes that the target name and the shared libary name
|
||||
#// are the same.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildOneProject($$$$$)
|
||||
{
|
||||
my ($project_path, $target_name, $alias_lib, $alias_xSYM, $component) = @_;
|
||||
|
||||
BuildOneProjectWithOutput($project_path, $target_name, $target_name,
|
||||
$alias_lib, $alias_xSYM, $component);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// For compatiblity with existing scripts, BuildProject now just calls
|
||||
#// BuildOneProjectWithOutput, with the output name and target name identical.
|
||||
#// Note that this routine assumes that the target name and the shared libary name
|
||||
#// are the same. No aliases of the output are made.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildProject($$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
|
||||
BuildOneProjectWithOutput($project_path, $target_name, $target_name, 0, 0, 0);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Identical to BuildProject but clobbers the project before building it.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildProjectClean($$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
my ($save_clobber_flag) = $main::CLOBBER_PROJECTS;
|
||||
$main::CLOBBER_PROJECTS = 1;
|
||||
BuildOneProjectWithOutput($project_path, $target_name, $target_name, 0, 0, 0);
|
||||
$main::CLOBBER_PROJECTS = $save_clobber_flag;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Make resource aliases for one directory
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildFolderResourceAliases($$)
|
||||
{
|
||||
my($src_dir, $dest_dir) = @_;
|
||||
|
||||
# get a list of all the resource files
|
||||
opendir(SRCDIR, $src_dir) || die("can't open $src_dir");
|
||||
my(@resource_files) = readdir(SRCDIR);
|
||||
closedir(SRCDIR);
|
||||
|
||||
# make aliases for each one into the dest directory
|
||||
print("Placing aliases to all files from $src_dir in $dest_dir\n");
|
||||
for ( @resource_files )
|
||||
{
|
||||
next if $_ eq "CVS";
|
||||
#print(" Doing $_\n");
|
||||
if (-l $src_dir.$_)
|
||||
{
|
||||
print(" $_ is an alias\n");
|
||||
next;
|
||||
}
|
||||
my($file_name) = $src_dir . $_;
|
||||
MakeAlias($file_name, $dest_dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// DelayFor
|
||||
#//
|
||||
#// Delay for the given number of seconds, allowing the script to be cancelled
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub DelayFor($)
|
||||
{
|
||||
my($delay_secs) = @_;
|
||||
|
||||
STDOUT->autoflush(1);
|
||||
|
||||
my($end_time) = time() + $delay_secs;
|
||||
|
||||
my($last_time) = 0;
|
||||
my($cur_time) = time();
|
||||
|
||||
while ($cur_time < $end_time)
|
||||
{
|
||||
$cur_time = time();
|
||||
if ($cur_time > $last_time)
|
||||
{
|
||||
print ".";
|
||||
$last_time = $cur_time;
|
||||
}
|
||||
|
||||
WaitNextEvent();
|
||||
}
|
||||
|
||||
print "\n";
|
||||
STDOUT->autoflush(0);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// TimeStart
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub TimeStart()
|
||||
{
|
||||
return time();
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// TimeEnd
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub TimeEnd($$)
|
||||
{
|
||||
use integer;
|
||||
|
||||
my($start_time, $operation_name) = @_;
|
||||
my($end_time) = time();
|
||||
|
||||
my($tot_sec) = $end_time - $start_time;
|
||||
|
||||
my($seconds) = $tot_sec;
|
||||
|
||||
my($hours) = $seconds / (60 * 60);
|
||||
$seconds -= $hours * (60 * 60);
|
||||
|
||||
my($minutes) = $seconds / 60;
|
||||
$seconds -= $minutes * 60;
|
||||
|
||||
print "$operation_name took $hours hours $minutes minutes and $seconds seconds\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Remove all files from a tree, leaving directories intact (except "CVS").
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub EmptyTree($)
|
||||
{
|
||||
my ($root) = @_;
|
||||
#print "EmptyTree($root)\n";
|
||||
opendir(DIR, $root);
|
||||
my $sub;
|
||||
foreach $sub (readdir(DIR))
|
||||
{
|
||||
my $fullpathname = $root.$sub; # -f, -d only work on full paths
|
||||
|
||||
# Don't call empty tree for the alias of a directory.
|
||||
# -d returns true for the alias of a directory, false for a broken alias)
|
||||
|
||||
if (-d $fullpathname)
|
||||
{
|
||||
if (-l $fullpathname) # delete aliases
|
||||
{
|
||||
unlink $fullpathname;
|
||||
next;
|
||||
}
|
||||
EmptyTree($fullpathname.":");
|
||||
if ($sub eq "CVS")
|
||||
{
|
||||
#print "rmdir $fullpathname\n";
|
||||
rmdir $fullpathname;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unless (unlink $fullpathname) { die "Failed to delete $fullpathname\n"; }
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Recurse through a directory hierarchy, looking for MANIFEST files.
|
||||
#// Currently unused.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub ScanForManifestFiles($$$$)
|
||||
{
|
||||
my($dir, $theme_root, $theme_name, $dist_dir) = @_;
|
||||
|
||||
opendir(DIR, $dir) or die "Cannot open dir $dir\n";
|
||||
my @files = readdir(DIR);
|
||||
closedir DIR;
|
||||
|
||||
my $file;
|
||||
|
||||
foreach $file (@files)
|
||||
{
|
||||
my $filepath = $dir.":".$file;
|
||||
|
||||
if (-d $filepath)
|
||||
{
|
||||
# print "Looking for MANIFEST files in $filepath\n";
|
||||
ScanForManifestFiles($filepath, $theme_root, $theme_name, $dist_dir);
|
||||
}
|
||||
elsif ($file eq "MANIFEST")
|
||||
{
|
||||
# print "Doing manifest file $filepath\n";
|
||||
|
||||
# Get the dest path from the first line of the file
|
||||
|
||||
open(MANIFEST, $filepath) || die "Could not open file $file";
|
||||
# Read in the path if available
|
||||
my($dest_line) = <MANIFEST>;
|
||||
chomp $dest_line;
|
||||
close MANIFEST;
|
||||
|
||||
$dest_line =~ s|^#!dest[\t ]+|| || die "No destination line found in $filepath\n";
|
||||
|
||||
my($dest_path) = $dist_dir."chrome:skins:$theme_name:$dest_line";
|
||||
# print " Destination is $dest_path\n";
|
||||
|
||||
InstallResources($filepath, "$dest_path", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------
|
||||
# SetupBuildLog
|
||||
#-----------------------------------------------
|
||||
sub SetupBuildLog($$)
|
||||
{
|
||||
my($logfile_path, $timestamped_log) = @_;
|
||||
|
||||
my($logdir) = "";
|
||||
my($logfile) = $logfile_path;
|
||||
|
||||
if ($logfile_path =~ /(.+?:)([^:]+)$/) # ? for non-greedy match
|
||||
{
|
||||
$logdir = $1;
|
||||
$logfile = $2;
|
||||
|
||||
mkpath($logdir);
|
||||
}
|
||||
|
||||
if ($timestamped_log)
|
||||
{
|
||||
#Use time-stamped names so that you don't clobber your previous log file!
|
||||
my $now = localtime();
|
||||
while ($now =~ s@:@.@) {} # replace all colons by periods
|
||||
OpenErrorLog("${logdir}${now}");
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenErrorLog("${logdir}${logfile}");
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------
|
||||
# SetBuildNumber
|
||||
#-----------------------------------------------
|
||||
sub SetBuildNumber($$)
|
||||
{
|
||||
my($build_num_file, $files_to_touch) = @_;
|
||||
|
||||
# Make sure we add the config dir to search, to pick up mozBDate.pm
|
||||
# Need to do this dynamically, because this module can be used before
|
||||
# mozilla/config has been checked out.
|
||||
|
||||
my ($inc_path) = $0; # $0 is the path to the parent script
|
||||
$inc_path =~ s/:build:mac:build_scripts:.+$/:config/;
|
||||
push(@INC, $inc_path);
|
||||
|
||||
require mozBDate;
|
||||
|
||||
mozBDate::UpdateBuildNumber($build_num_file, $main::MOZILLA_OFFICIAL);
|
||||
|
||||
my($file);
|
||||
foreach $file (@$files_to_touch)
|
||||
{
|
||||
print "Writing build number to $file from ${file}.in\n";
|
||||
mozBDate::SubstituteBuildNumber($file, $build_num_file, "${file}.in");
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------
|
||||
# SetTimeBomb
|
||||
#-----------------------------------------------
|
||||
sub SetTimeBomb($$)
|
||||
{
|
||||
my ($warn_days, $bomb_days) = @_;
|
||||
|
||||
system("perl :mozilla:config:mac-set-timebomb.pl $warn_days $bomb_days");
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Regenerate a configuration header file if necessary
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub UpdateConfigHeader($)
|
||||
{
|
||||
my($config_path) = @_;
|
||||
|
||||
my($config, $oldconfig) = ("", "");
|
||||
my($define, $definevalue, $defines);
|
||||
my($k, $l,);
|
||||
|
||||
foreach $k (keys(%main::options))
|
||||
{
|
||||
if ($main::options{$k})
|
||||
{
|
||||
foreach $l (keys(%{$main::optiondefines{$k}}))
|
||||
{
|
||||
$my::defines{$l} = $main::optiondefines{$k}{$l};
|
||||
print "Setting up my::defines{$l}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $config_headerfile = current_directory().$config_path;
|
||||
if (-e $config_headerfile)
|
||||
{
|
||||
open(CONFIG_HEADER, "< $config_headerfile") || die "$config_headerfile: $!\n";
|
||||
my($line);
|
||||
while ($line = <CONFIG_HEADER>)
|
||||
{
|
||||
if ($line =~ m/#define\s+([^\s]*)\s+([^\s]*)\s*\n/)
|
||||
{
|
||||
$define = $1;
|
||||
$definevalue = $2;
|
||||
|
||||
#canonicalize so that whitespace changes are not significant
|
||||
my $canon_value = "#define " . $define . " " . $definevalue . "\n";
|
||||
$oldconfig .= $canon_value;
|
||||
|
||||
if (exists ($my::defines{$define}) and ($my::defines{$define} == $definevalue))
|
||||
{
|
||||
delete $my::defines{$define};
|
||||
$config .= $canon_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(CONFIG_HEADER);
|
||||
}
|
||||
|
||||
if (%my::defines)
|
||||
{
|
||||
foreach $k (keys(%my::defines))
|
||||
{
|
||||
$config .= "#define " . $k . " " . $my::defines{$k} . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
my $file_name = basename($config_headerfile);
|
||||
if (($config ne $oldconfig) || (!-e $config_headerfile))
|
||||
{
|
||||
printf("Writing new configuration header $file_name\n");
|
||||
open(CONFIG_HEADER, "> $config_headerfile") || die "$config_headerfile: $!\n";
|
||||
print(CONFIG_HEADER "/* This file is auto-generated based on build options. Do not edit. */\n");
|
||||
print CONFIG_HEADER ($config);
|
||||
close(CONFIG_HEADER);
|
||||
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $config_headerfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Configuration header $file_name is up-to-date\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@@ -1,660 +0,0 @@
|
||||
#!perl
|
||||
package Moz::CodeWarriorLib;
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
CodeWarriorLib - supply interface to CodeWarrior
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#!perl
|
||||
use CodeWarriorLib;
|
||||
CodeWarriorLib::activate();
|
||||
$had_errors = CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Replaces the AppleScript library I<CodeWarriorLib>.
|
||||
|
||||
=over 4
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use Mac::Types;
|
||||
use Mac::Events;
|
||||
use Mac::AppleEvents;
|
||||
use Mac::AppleEvents::Simple;
|
||||
use Mac::Processes;
|
||||
use Mac::MoreFiles;
|
||||
use Mac::StandardFile;
|
||||
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '1.02';
|
||||
|
||||
my($app) = 'CWIE';
|
||||
my($scriptDir) = cwd(); # could use $0 for this
|
||||
my($ide_loc_file) = "";
|
||||
|
||||
# 0 == don't switch CWIE to front app in do_event(), 1 == do switch
|
||||
# note: activate() still switches when called
|
||||
$Mac::AppleEvents::Simple::SWITCH = 0;
|
||||
# $Mac::AppleEvents::Simple::WARN = 1;
|
||||
|
||||
# supply your own path to the source here
|
||||
#_test('PowerPudgeIV:mozilla:mozilla:');
|
||||
|
||||
# If you want to understand the gobbldeygook that's used to build Apple Events,
|
||||
# you should start by reading the AEGizmos documentation.
|
||||
|
||||
=pod
|
||||
|
||||
=item _get_project($full_path)
|
||||
|
||||
A private routine returning a reference to the open project with the given name,
|
||||
or else the empty string (when that project is not open)
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
=cut
|
||||
|
||||
sub _get_project ($) {
|
||||
my(
|
||||
$full_path, $candidate_projects
|
||||
) = @_;
|
||||
$candidate_projects = _doc_named(basename($full_path, '*'));
|
||||
if ($candidate_projects) {
|
||||
my($cps) = _get_dobj($candidate_projects);
|
||||
my($num) = AECountItems($cps);
|
||||
if ($num) { # is a list
|
||||
foreach (1 .. AECountItems($cps)) {
|
||||
my($cp) = AEGetNthDesc($cps, $_);
|
||||
if (lc $full_path eq lc _full_path($cp)) {
|
||||
return($cp);
|
||||
}
|
||||
}
|
||||
} else { # is only one, not a list
|
||||
if (lc $full_path eq lc _full_path($cps)) {
|
||||
return($cps);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item build_project
|
||||
|
||||
Build a selected target of a project, saving any errors to a file, if supplied.
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
If target_name is the empty string, the current target of the selected project
|
||||
will be built, else, target_name should be a string matching a target name in
|
||||
the selected project.
|
||||
|
||||
If error_path is the empty string, errors will not be saved to a file,
|
||||
else, error_path should be the full path of a file to save error messages into.
|
||||
|
||||
=cut
|
||||
|
||||
$CodeWarriorLib::CLOSE_PROJECTS_FIRST = 0; # If true we close then make. If false, make then close.
|
||||
my $last_project_built = "";
|
||||
my $last_project_was_closed = 0;
|
||||
|
||||
sub build_project ($;$$$) {
|
||||
my(
|
||||
$full_path, $target_name, $error_path,
|
||||
$remove_object, $p, $project_was_closed, $had_errors
|
||||
) = @_;
|
||||
_close_errors_window();
|
||||
|
||||
if ($CodeWarriorLib::CLOSE_PROJECTS_FIRST && ($last_project_built ne $full_path))
|
||||
{
|
||||
# If we're in "close first" mode, we don't close if the current project
|
||||
# is the same as the previous one.
|
||||
if ($last_project_was_closed) {
|
||||
$p = _get_project($last_project_built);
|
||||
_close($p);
|
||||
}
|
||||
$last_project_built = $full_path;
|
||||
$last_project_was_closed = 0; # now refers to the new project
|
||||
}
|
||||
$project_was_closed = 0;
|
||||
while (1) {
|
||||
$p = _get_project($full_path);
|
||||
if (!$p) {
|
||||
if ($project_was_closed) {
|
||||
print "### Error - request for project document failed after opening\n";
|
||||
die "### possibly CW Pro 4 bug: be sure to close your Find window\n";
|
||||
}
|
||||
$project_was_closed = 1;
|
||||
$last_project_was_closed = 1;
|
||||
_open_file($full_path);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$had_errors = 0;
|
||||
if ($target_name eq '') {
|
||||
if ($remove_object) {_remove_object($p)}
|
||||
_build($p);
|
||||
} else {
|
||||
if ($remove_object) {_remove_object($p, $target_name)}
|
||||
_build($p, $target_name);
|
||||
}
|
||||
|
||||
if ($error_path ne '') {
|
||||
_save_errors_window($error_path);
|
||||
}
|
||||
$had_errors = _close_errors_window();
|
||||
|
||||
if (!$CodeWarriorLib::CLOSE_PROJECTS_FIRST)
|
||||
{
|
||||
if ($project_was_closed) {
|
||||
$p = _get_project($full_path);
|
||||
_close($p);
|
||||
}
|
||||
}
|
||||
|
||||
return($had_errors);
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item appIsRunning()
|
||||
|
||||
=cut
|
||||
sub _appIsRunning($)
|
||||
{
|
||||
my ($appSignature) = @_;
|
||||
my ($psi);
|
||||
my ($found) = 0;
|
||||
my ($appPSN);
|
||||
|
||||
foreach $psi (values(%Process))
|
||||
{
|
||||
if ($psi->processSignature() eq $appSignature)
|
||||
{
|
||||
$appPSN = $psi->processNumber();
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item appIsFrontmost()
|
||||
|
||||
=cut
|
||||
sub _appIsFrontmost($)
|
||||
{
|
||||
my ($appSignature) = @_;
|
||||
my ($psi);
|
||||
my ($found) = 0;
|
||||
my ($appPSN);
|
||||
|
||||
foreach $psi (values(%Process))
|
||||
{
|
||||
if ($psi->processSignature() eq $appSignature)
|
||||
{
|
||||
$appPSN = $psi->processNumber();
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return (GetFrontProcess() == $appPSN);
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item activate()
|
||||
|
||||
Launches CodeWarrior and brings it to the front.
|
||||
|
||||
Once found, path will be saved in $idepath_file for future reference.
|
||||
Edit or delete this file to change the location of the IDE. If app is
|
||||
moved, C<activate()> will prompt for a new location.
|
||||
|
||||
First looks for an open CodeWarrior app. Second, tries to open previously
|
||||
saved location in ':idepath.txt'. Third, tries to find it and allow user
|
||||
to choose it with Navigation Services (if present). Fourth, uses good old
|
||||
GUSI routines built-in to MacPerl for a Choose Directory dialog box.
|
||||
|
||||
=cut
|
||||
|
||||
sub activate ($) {
|
||||
|
||||
$ide_loc_file = $_[0]; # save in global
|
||||
|
||||
my($filepath, $appath, $psi) = ($ide_loc_file);
|
||||
|
||||
foreach $psi (values(%Process)) {
|
||||
if ($psi->processSignature() eq $app) {
|
||||
$appath = $psi->processAppSpec();
|
||||
_save_appath($filepath, $appath);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$appath || !-x $appath) {
|
||||
$appath = _read_appath($filepath);
|
||||
}
|
||||
|
||||
if (!$appath || ! -x $appath)
|
||||
{
|
||||
# make sure that MacPerl is a front process
|
||||
#ActivateApplication('McPL');
|
||||
MacPerl::Answer("Please locate the CodeWarrior application.", "OK");
|
||||
|
||||
# prompt user for the file name, and store it
|
||||
my $macFile = StandardGetFile( 0, "APPL");
|
||||
if ( $macFile->sfGood() )
|
||||
{
|
||||
$appath = $macFile->sfFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Operation canceled\n";
|
||||
}
|
||||
|
||||
# if (eval {require Mac::Navigation}) {
|
||||
# my($options, $nav);
|
||||
# Mac::Navigation->import();
|
||||
# $options = NavGetDefaultDialogOptions();
|
||||
# $options->message('Where is CodeWarrior IDE?');
|
||||
# $options->windowTitle('Find CodeWarrior IDE');
|
||||
# $nav = NavChooseObject($Application{$app}, $options);
|
||||
# die "CodeWarrior IDE not found.\n" if (!$nav || !$nav->file(1));
|
||||
# $appath = $nav->file(1);
|
||||
# } else {
|
||||
# local(*D);
|
||||
# my $cwd = `pwd`;
|
||||
# $appath = _get_folder(
|
||||
# 'Where is the CW IDE folder?',
|
||||
# dirname($Application{$app})
|
||||
# );
|
||||
# die "CodeWarrior IDE not found.\n" if !$appath;
|
||||
# opendir(D, $appath) or die $!;
|
||||
# chdir($appath);
|
||||
# foreach my $file (sort readdir (D)) {
|
||||
# my(@app) = MacPerl::GetFileInfo($file);
|
||||
# if ($app[0] && $app[1] &&
|
||||
# $app[1] eq 'APPL' && $app[0] eq $app
|
||||
# ) {
|
||||
# $appath .= $file;
|
||||
# last;
|
||||
# }
|
||||
# }
|
||||
# chomp($cwd);
|
||||
# chdir($cwd);
|
||||
# }
|
||||
_save_appath($filepath, $appath);
|
||||
}
|
||||
|
||||
my($lp) = LaunchParam->new(
|
||||
launchAppSpec => $appath,
|
||||
launchControlFlags => launchContinue() + launchNoFileFlags()
|
||||
);
|
||||
|
||||
unless (LaunchApplication($lp)) {
|
||||
unlink($filepath);
|
||||
die $^E;
|
||||
}
|
||||
|
||||
# wait for CodeWarrior to show up in the list of processes
|
||||
while (!_appIsRunning('CWIE'))
|
||||
{
|
||||
WaitNextEvent();
|
||||
}
|
||||
|
||||
# wait for CodeWarrior to come to the front
|
||||
while (!_appIsFrontmost('CWIE'))
|
||||
{
|
||||
WaitNextEvent();
|
||||
}
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item getCodeWarriorPath()
|
||||
|
||||
Returns a file path relative to the CodeWarrior folder
|
||||
|
||||
=cut
|
||||
|
||||
sub getCodeWarriorPath($)
|
||||
{
|
||||
my($subfolder)=@_;
|
||||
|
||||
my($app_path) = _read_appath($ide_loc_file);
|
||||
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
|
||||
|
||||
my($codewarrior_root) = $app_path;
|
||||
$codewarrior_root =~ s/[^:]*$//;
|
||||
return ($codewarrior_root . $subfolder);
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item getCodeWarriorIDEName()
|
||||
|
||||
Returns the name of the CodeWarrior application
|
||||
|
||||
=cut
|
||||
|
||||
sub getCodeWarriorIDEName()
|
||||
{
|
||||
my($subfolder)=@_;
|
||||
|
||||
my($app_path) = _read_appath($ide_loc_file);
|
||||
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
|
||||
|
||||
my(@codewarrior_path) = split(/:/, $app_path);
|
||||
return pop(@codewarrior_path);
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item quit()
|
||||
|
||||
Quits CodeWarrior.
|
||||
|
||||
=cut
|
||||
|
||||
sub quit() {
|
||||
|
||||
$last_project_built = "";
|
||||
$last_project_was_closed = 0;
|
||||
|
||||
my($evt) = do_event(qw/aevt quit/, $app);
|
||||
}
|
||||
|
||||
|
||||
sub _build ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _remove_object ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _open_file ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
do_event(qw/aevt odoc/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
sub import_project ($$) {
|
||||
my($xml_file, $project_path) = @_;
|
||||
|
||||
my($prm) = "kocl:type(PRJD), rtyp:TEXT(@), data:TEXT(@), &subj:'null'()";
|
||||
|
||||
my($evt) = do_event(qw/core crel/, $app, $prm, $project_path, $xml_file);
|
||||
my($result) = _get_event_result($evt);
|
||||
|
||||
if ($result eq "") {
|
||||
_close(_get_project($project_path));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub export_project ($$) {
|
||||
my($project_path, $xml_out_path) = @_;
|
||||
my($p, $project_was_closed);
|
||||
|
||||
$project_was_closed = 0;
|
||||
while (1) {
|
||||
$p = _get_project($project_path);
|
||||
if (!$p) {
|
||||
if ($project_was_closed) {
|
||||
print "### Error - request for project document failed after opening\n";
|
||||
die "### possibly CW bug: be sure to close your Find window\n";
|
||||
}
|
||||
$project_was_closed = 1;
|
||||
_open_file($project_path);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# avoid problems with the Project Messages window
|
||||
_close_named_window("Project Messages");
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:indx, want:type(PRJD), " .
|
||||
q"seld:1, from:'null'()}, kfil:TEXT(@)";
|
||||
|
||||
my($evt) = do_event(qw/CWIE EXPT/, $app, $prm, $xml_out_path);
|
||||
|
||||
if ($project_was_closed) {
|
||||
$p = _get_project($project_path);
|
||||
_close($p);
|
||||
}
|
||||
|
||||
return _get_event_result($evt);
|
||||
}
|
||||
|
||||
sub _doc_named ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:test, want:type(docu), from:'null'(), " .
|
||||
q"seld:cmpd{relo:'= ', 'obj1':obj {form:prop, want:type" .
|
||||
q"(prop), seld:type(pnam), from:'exmn'()}, 'obj2':TEXT(@)}}";
|
||||
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm, $_[0]);
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? undef : $evt);
|
||||
}
|
||||
|
||||
sub _full_path ($) {
|
||||
my($obj) = $_[0];
|
||||
my($prm) =
|
||||
q"'----':obj {form:prop, want:type(prop), seld:type(FILE), " .
|
||||
q"from:" . AEPrint($_[0]) . q"}, rtyp:type(TEXT)";
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm);
|
||||
|
||||
return MacPerl::MakePath(
|
||||
MacUnpack('fss ', (
|
||||
AEGetParamDesc($evt->{REP}, keyDirectObject()))->data()->get()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sub _save_errors_window ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}";
|
||||
do_event(qw/MMPR SvMs/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
|
||||
sub _close_errors_window () {
|
||||
return _close_named_window('Errors & Warnings');
|
||||
}
|
||||
|
||||
|
||||
sub _close_named_window ($) {
|
||||
my($window_name) = @_;
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(cwin), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
my($evt) = do_event(qw/core clos/, $app, $prm, $window_name);
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? 1 : 0);
|
||||
}
|
||||
|
||||
sub _close () {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
do_event(qw/core clos/, $app, $prm);
|
||||
}
|
||||
|
||||
sub _get_dobj ($) {
|
||||
return(AEGetParamDesc($_[0]->{REP}, keyDirectObject()));
|
||||
}
|
||||
|
||||
sub _get_folder ($$) {
|
||||
require 'GUSI.ph';
|
||||
my($prompt, $default) = @_;
|
||||
MacPerl::Choose(
|
||||
GUSI::AF_FILE(), 0, $prompt, '',
|
||||
GUSI::CHOOSE_DIR() + ($default ? &GUSI::CHOOSE_DEFAULT : 0),
|
||||
$default
|
||||
);
|
||||
}
|
||||
|
||||
sub _get_event_result ($)
|
||||
{
|
||||
my($evt) = @_;
|
||||
|
||||
my($result) = $evt->{ERROR};
|
||||
|
||||
if ( $result eq "" && $evt->{ERRNO} != 0 )
|
||||
{
|
||||
$result = "unknown error (".$evt->{ERRNO}.")";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
sub _save_appath ($$) {
|
||||
|
||||
my($cwd) = cwd(); # remember the current working dir
|
||||
chdir($scriptDir); # change dir to the script dir
|
||||
|
||||
local(*F);
|
||||
open(F, '>' . $_[0]) or die $!;
|
||||
print F $_[1];
|
||||
close(F);
|
||||
|
||||
chdir($cwd); # restore the cwd
|
||||
}
|
||||
|
||||
sub _read_appath ($) {
|
||||
|
||||
my($filepath) = @_;
|
||||
|
||||
my($cwd) = cwd(); # remember the current working dir
|
||||
chdir($scriptDir); # change dir to the script dir
|
||||
|
||||
if (! -e $filepath) {
|
||||
return "";
|
||||
}
|
||||
|
||||
local(*F);
|
||||
open(F, $filepath);
|
||||
my($appath) = <F>;
|
||||
close(F);
|
||||
|
||||
chdir($cwd); # restore the cwd
|
||||
return($appath);
|
||||
}
|
||||
|
||||
|
||||
sub _test ($) {
|
||||
activate($ide_loc_file);
|
||||
my($path) = $_[0];
|
||||
build_project(
|
||||
"${path}modules:xml:macbuild:XML.mcp", '',
|
||||
"${path}build:mac:Mozilla.BuildLog.part"
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=pod
|
||||
|
||||
=back
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
=over 4
|
||||
|
||||
=item v1.02, September 23, 1998
|
||||
|
||||
Made fixes in finding and saving location of CodeWarrior IDE.
|
||||
|
||||
=item v1.01, June 1, 1998
|
||||
|
||||
Made fixes to C<chdir()> in C<activate()>, made C<activate()> more robust
|
||||
in finding CodeWarrior IDE, added global variable to NOT switch to IDE
|
||||
for each sent event, a few other fixes.
|
||||
|
||||
=item v1.00, May 30, 1998
|
||||
|
||||
First shot
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Chris Nandor F<E<lt>pudge@pobox.comE<gt>>, and the author of the
|
||||
original I<CodeWarriorLib>, Scott Collins F<E<lt>scc@netscape.comE<gt>>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildProject L<Moz>.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
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 Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
=cut
|
||||
@@ -1,573 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::Jar;
|
||||
|
||||
#
|
||||
# Module for creating jar files, either using a jar manifest, or
|
||||
# simply jarring up folders on disk.
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use Archive::Zip;
|
||||
use File::Path;
|
||||
|
||||
use Mac::Files;
|
||||
|
||||
use Moz::Moz;
|
||||
|
||||
use vars qw( @ISA @EXPORT );
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
CreateJarFileFromDirectory
|
||||
CreateJarFromManifest
|
||||
WriteOutJarFiles
|
||||
SanityCheckJarOptions
|
||||
);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Add the contents of a directory to the zip file
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub _addDirToJar($$$$)
|
||||
{
|
||||
my($dir, $jar_root, $zip, $compress) = @_;
|
||||
|
||||
opendir(DIR, $dir) or die "Error: Cannot open dir $dir\n";
|
||||
my @files = readdir(DIR);
|
||||
closedir DIR;
|
||||
|
||||
my $unix_jar_root = $jar_root;
|
||||
$unix_jar_root =~ s|:|/|g; # colon to slash conversion
|
||||
|
||||
my $file;
|
||||
|
||||
foreach $file (@files)
|
||||
{
|
||||
my $filepath = $dir.":".$file;
|
||||
|
||||
if (-d $filepath)
|
||||
{
|
||||
print "Adding files to jar from $filepath\n";
|
||||
_addDirToJar($filepath, $jar_root, $zip, $compress);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $member = Archive::Zip::Member->newFromFile($filepath);
|
||||
die "Error: Failed to create zip file member $filepath\n" unless $member;
|
||||
|
||||
my $unixName = $filepath;
|
||||
$unixName =~ s|:|/|g; # colon to slash conversion
|
||||
$unixName =~ s|^$unix_jar_root||; # relativise
|
||||
|
||||
$member->fileName($unixName);
|
||||
|
||||
# print "Adding $file as $unixName\n";
|
||||
|
||||
if ($compress) {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
|
||||
} else {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
|
||||
}
|
||||
|
||||
$zip->addMember($member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Add the contents of a directory to the zip file
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub CreateJarFileFromDirectory($$$)
|
||||
{
|
||||
my($srcdir, $jarpath, $compress) = @_;
|
||||
|
||||
my $zip = Archive::Zip->new();
|
||||
|
||||
_addDirToJar($srcdir, $srcdir, $zip, $compress);
|
||||
|
||||
print "Saving zip file...\n";
|
||||
my $status = $zip->writeToFileNamed($jarpath);
|
||||
if ($status == 0) {
|
||||
print "Zipping completed successfully\n";
|
||||
} else {
|
||||
print "Error saving zip file\n";
|
||||
}
|
||||
|
||||
# set the file type/creator to something reasonable
|
||||
MacPerl::SetFileInfo("ZIP ", "ZIP ", $jarpath);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# printZipContents
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub printZipContents($)
|
||||
{
|
||||
my($zip) = @_;
|
||||
|
||||
my(@members) = $zip->memberNames();
|
||||
|
||||
print "Zip contains:\n";
|
||||
|
||||
my($member);
|
||||
foreach $member (@members)
|
||||
{
|
||||
print " $member\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# safeSaveJarFile
|
||||
#
|
||||
# Archive::Zip has a problem where you cannot save a zip file on top of
|
||||
# an existing zip file that it has open, because it holds references
|
||||
# into that zip. So we have to save to a temp file, then do a swap.
|
||||
#
|
||||
# Note that the zip will become invalid after this operation.
|
||||
# If you want to do further operations on it, you'll have to reread it.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub safeSaveJarFile($$)
|
||||
{
|
||||
my($zip, $full_dest_path) = @_;
|
||||
|
||||
my($temp_file_name) = $full_dest_path."_temp";
|
||||
|
||||
($zip->writeToFileNamed($temp_file_name) == Archive::Zip::AZ_OK) || die "Error: died writing jar to temp file $temp_file_name\n";
|
||||
|
||||
unlink $full_dest_path;
|
||||
|
||||
(rename $temp_file_name, $full_dest_path) || die "Error: Failed to rename $temp_file_name\n";
|
||||
|
||||
MacPerl::SetFileInfo("ZIP ", "ZIP ", $full_dest_path);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# addToJarFile
|
||||
#
|
||||
# Add a file to a jar file
|
||||
#
|
||||
# Parameters:
|
||||
# 1. Jar ID. Unix path of jar file inside chrome.
|
||||
# 2. Abs path to jar.mn file (i.e. source) (mac breaks)
|
||||
# 3. File source, relative to jar.mn path (mac breaks)
|
||||
# 4. Abs path to the resulting .jar file (mac breaks)
|
||||
# 5. Relative file path within the jar (unix breaks)
|
||||
# 6. Reference to hash of jar files
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub addToJarFile($$$$$$$)
|
||||
{
|
||||
my($jar_id, $jar_man_dir, $file_src, $jar_path, $file_jar_path, $override, $jars) = @_;
|
||||
|
||||
# print "addToJarFile with:\n $jar_man_dir\n $file_src\n $jar_path\n $file_jar_path\n";
|
||||
|
||||
unless ($jar_path =~ m/(.+:)([^:]+)$/) { die "Error: Bad jar path $jar_path\n"; }
|
||||
|
||||
my($target_dir) = $1;
|
||||
my($jar_name) = $2;
|
||||
|
||||
$target_dir =~ s/[^:]+$//;
|
||||
|
||||
# print "¥ $target_dir $jar_name\n";
|
||||
|
||||
# find the source file
|
||||
my($src) = $jar_man_dir.":".$file_src;
|
||||
if ((!-e $src) && ($file_src =~ m/.+:([^:]+)$/)) # src does not exist. Fall back to looking for src in jar.mn dir
|
||||
{
|
||||
$file_src = $1;
|
||||
$src = $jar_man_dir.":".$file_src;
|
||||
|
||||
if (!-e $src) {
|
||||
die "Error: Can't find chrome file $src\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
my($zip) = $jars->{$jar_id};
|
||||
unless ($zip) { die "Error: Can't find Zip entry for $jar_id\n"; }
|
||||
|
||||
# print "Adding $file_src to jar file $jar_path at $file_jar_path\n";
|
||||
my($member) = Archive::Zip::Member->newFromFile($src);
|
||||
unless ($member) { die "Error: Failed to create zip file member $src\n"; }
|
||||
|
||||
$member->fileName($file_jar_path);
|
||||
|
||||
my($compress) = 1;
|
||||
if ($compress) {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
|
||||
$member->desiredCompressionLevel(Archive::Zip::COMPRESSION_LEVEL_DEFAULT); # defaults to 6
|
||||
} else {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
|
||||
}
|
||||
|
||||
my($old_member) = $zip->memberNamed($file_jar_path);
|
||||
|
||||
if ($override)
|
||||
{
|
||||
if ($old_member)
|
||||
{
|
||||
# print "Overriding $file_jar_path in jar file $jar_id\n";
|
||||
# need to compare mod dates or use the + here
|
||||
$zip->removeMember($old_member);
|
||||
}
|
||||
|
||||
$zip->addMember($member);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($old_member)
|
||||
{
|
||||
#compare dates here
|
||||
my($member_moddate) = $old_member->lastModTime();
|
||||
my($file_moddate) = GetFileModDate($src);
|
||||
|
||||
if ($file_moddate > $member_moddate)
|
||||
{
|
||||
print "Updating older file $file_jar_path in $jar_id\n";
|
||||
$zip->removeMember($old_member);
|
||||
$zip->addMember($member);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$zip->addMember($member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($main::options{chrome_files}) # we install raw files too
|
||||
{
|
||||
my($rel_path) = $file_jar_path;
|
||||
$rel_path =~ s|/|:|g; # slash to colons
|
||||
|
||||
my($dir_name) = $jar_name;
|
||||
$dir_name =~ s/\.jar$//;
|
||||
|
||||
my($dst) = $target_dir.$dir_name.":".$rel_path;
|
||||
|
||||
# print "Aliassing $src\n to\n$dst\n";
|
||||
if ($override)
|
||||
{
|
||||
unlink $dst;
|
||||
MakeAlias($src, $dst); # don't check errors, otherwise we fail on replacement
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-e $dst)
|
||||
{
|
||||
#compare dates here
|
||||
my($dst_moddate) = GetFileModDate($dst);
|
||||
my($file_moddate) = GetFileModDate($src);
|
||||
|
||||
if ($file_moddate > $dst_moddate)
|
||||
{
|
||||
print "Updating older file $rel_path in $dir_name\n";
|
||||
unlink $dst;
|
||||
MakeAlias($src, $dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAlias($src, $dst);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# setupJarFile
|
||||
#
|
||||
# setup a zip for writing
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub setupJarFile($$$)
|
||||
{
|
||||
my($jar_id, $dest_path, $jar_hash) = @_;
|
||||
|
||||
# print "Creating jar file $jar_id at $jar_path\n";
|
||||
|
||||
my($jar_file) = $jar_id;
|
||||
$jar_file =~ s|/|:|g; # slash to colons
|
||||
my($full_jar_path) = full_path_to($dest_path.":".$jar_file);
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
my($zip) = $jar_hash->{$jar_id};
|
||||
if (!$zip) # if we haven't made it already, do so
|
||||
{
|
||||
my($zip) = Archive::Zip->new();
|
||||
$jar_hash->{$jar_id} = $zip;
|
||||
|
||||
# does the jar file exist already? If so, read it in
|
||||
if (-e $full_jar_path)
|
||||
{
|
||||
print "Reading in jar file $jar_id\n";
|
||||
if ($zip->read($full_jar_path) != Archive::Zip::AZ_OK) { die "Error: Failed to re-read $full_jar_path\n"; }
|
||||
|
||||
# printZipContents($zip);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# installing files.
|
||||
# nothing to do. MakeAlias creates dirs as needed.
|
||||
|
||||
# add this jar to the list
|
||||
$jar_hash->{$jar_id} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# closeJarFile
|
||||
#
|
||||
# We're done with this jar file _for this jar.mn_. We may add more entries
|
||||
# to it later, so keep it open in the hash.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub closeJarFile($$)
|
||||
{
|
||||
my($jar_path, $jar_hash) = @_;
|
||||
|
||||
# print "Closing jar file $jar_path\n";
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# installing files.
|
||||
# nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# WriteOutJarFiles
|
||||
#
|
||||
# Now we dump out the jars
|
||||
#-------------------------------------------------------------------------------
|
||||
sub WriteOutJarFiles($$)
|
||||
{
|
||||
my($chrome_dir, $jars) = @_;
|
||||
|
||||
unless ($main::options{chrome_jars}) { return; }
|
||||
|
||||
my($full_chrome_path) = full_path_to($chrome_dir);
|
||||
|
||||
my($key);
|
||||
foreach $key (keys %$jars)
|
||||
{
|
||||
my($zip) = $jars->{$key};
|
||||
|
||||
my($rel_path) = $key;
|
||||
$rel_path =~ s/\//:/g;
|
||||
|
||||
my($output_path) = $full_chrome_path.":".$rel_path;
|
||||
|
||||
print "Writing zip file $key to $output_path\n";
|
||||
|
||||
# ensure the target dirs exist
|
||||
my($path) = $output_path;
|
||||
$path =~ s/[^:]+$//;
|
||||
mkpath($path);
|
||||
|
||||
# unlink $output_path; # remove any existing jar
|
||||
safeSaveJarFile($zip, $output_path);
|
||||
# $zip is invalid after this operation, so nuke it here
|
||||
$jars->{$key} = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# registerChromePackage
|
||||
#
|
||||
# Enter a chrome package into the installed-chrome.txt file
|
||||
#-------------------------------------------------------------------------------
|
||||
sub registerChromePackage($$$$$$)
|
||||
{
|
||||
my($jar_file, $file_path, $chrome_dir, $jar_hash, $chrome_type, $pkg_name) = @_;
|
||||
|
||||
my($manifest_subdir) = $jar_file;
|
||||
$manifest_subdir =~ s/:/\//g;
|
||||
|
||||
my($chrome_entry);
|
||||
|
||||
if ($main::options{use_jars}) {
|
||||
$chrome_entry = "$chrome_type,install,url,jar:resource:/chrome/$manifest_subdir!/$chrome_type/$pkg_name";
|
||||
} else {
|
||||
$manifest_subdir =~ s/\.jar$//;
|
||||
$chrome_entry = "$chrome_type,install,url,resource:/chrome/$manifest_subdir/$chrome_type/$pkg_name";
|
||||
}
|
||||
|
||||
# print "Entering $chrome_entry in installed-chrome.txt\n";
|
||||
|
||||
# ensure chrome_dir exists
|
||||
mkpath($chrome_dir);
|
||||
|
||||
my($inst_chrome) = ${chrome_dir}.":installed-chrome.txt";
|
||||
|
||||
if (open(CHROMEFILE, "<$inst_chrome")) {
|
||||
while (<CHROMEFILE>) {
|
||||
chomp;
|
||||
if ($_ eq $chrome_entry) {
|
||||
# $chrome_entry already appears in installed-chrome.txt file
|
||||
# just update the mod date
|
||||
my $now = time;
|
||||
utime($now, $now, $inst_chrome) || die "Error: Couldn't touch $inst_chrome";
|
||||
print "+++ updating chrome $inst_chrome\n+++\t\t$chrome_entry\n";
|
||||
close(CHROMEFILE) || die "Error: can't close $inst_chrome: $!";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
close(CHROMEFILE) || die "Error: can't close $inst_chrome: $!";
|
||||
}
|
||||
open(CHROMEFILE, ">>${inst_chrome}") || die "Error: Failed to open $inst_chrome\n";
|
||||
print(CHROMEFILE "${chrome_entry}\n");
|
||||
close(CHROMEFILE) || die "Error: Failed to close $inst_chrome\n";
|
||||
print "+++ adding chrome $inst_chrome\n+++\t\t$chrome_entry\n";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Create or add to a jar file from a jar.mn file.
|
||||
# Both arguments are relative to the mozilla root dir.
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub CreateJarFromManifest($$$)
|
||||
{
|
||||
my($jar_man_path, $dest_path, $jars) = @_;
|
||||
|
||||
if ($main::options{chrome_jars}) {
|
||||
print "Jarring from $jar_man_path\n";
|
||||
}
|
||||
if ($main::options{chrome_files}) {
|
||||
print "Installing files from $jar_man_path\n";
|
||||
}
|
||||
|
||||
$jar_man_path = full_path_to($jar_man_path);
|
||||
$dest_path = full_path_to($dest_path);
|
||||
|
||||
# if the jars hash is empty, nuke installed-chrome.txt
|
||||
if (! scalar(%$jars))
|
||||
{
|
||||
print "Nuking installed-chrome.txt\n";
|
||||
my($installed_chrome) = $dest_path.":installed-chrome.txt";
|
||||
# unlink $installed_chrome;
|
||||
}
|
||||
|
||||
my $jar_man_dir = "";
|
||||
my $jar_man_file = "";
|
||||
|
||||
if ($jar_man_path =~ /(.+):([^:]+)$/)
|
||||
{
|
||||
$jar_man_dir = $1; # no trailing :
|
||||
$jar_man_file = $2;
|
||||
}
|
||||
|
||||
# Keep a hash of jar files, keyed on relative jar path (e.g. "packages/core.jar")
|
||||
# Entries are open Archive::Zips (if zipping), and installed-chrome entries.
|
||||
|
||||
my($jar_id) = ""; # Current foo/bar.jar from jar.mn file
|
||||
my($jar_file) = ""; # relative path to jar file (from $dest_path), with mac separators
|
||||
my($full_jar_path);
|
||||
|
||||
open(FILE, "<$jar_man_path") || die "Error: could not open \"$jar_man_path\": $!";
|
||||
while (<FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# print "$line\n";
|
||||
|
||||
if ($line =~ /^\s*\#.*$/) { # skip comments
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~/^([\w\d.\-\_\\\/]+)\:\s*$/) # line start jar file entries
|
||||
{
|
||||
$jar_id = $1;
|
||||
$jar_file = $jar_id;
|
||||
$jar_file =~ s|/|:|g; # slash to colons
|
||||
$full_jar_path = $dest_path.":".$jar_file;
|
||||
|
||||
setupJarFile($jar_id, $dest_path, $jars);
|
||||
|
||||
}
|
||||
elsif ($line =~ /^(\+?)\s+([\w\d.\-\_\\\/]+)\s*(\([\w\d.\-\_\\\/]+\))?$\s*/) # jar file entry
|
||||
{
|
||||
my($override) = ($1 eq "+");
|
||||
my($file_dest) = $2;
|
||||
my($file_src) = $3;
|
||||
|
||||
if ($file_src) {
|
||||
$file_src = substr($file_src, 1, -1); #strip the ()
|
||||
} else {
|
||||
$file_src = $file_dest;
|
||||
}
|
||||
|
||||
$file_src =~ s|/|:|g;
|
||||
|
||||
if ($jar_file ne "") # if jar is open, add to jar
|
||||
{
|
||||
if ($file_dest =~ /([\w\d.\-\_]+)\/([\w\d.\-\_\\\/]+)contents.rdf/)
|
||||
{
|
||||
my $chrome_type = $1;
|
||||
my $pkg_name = $2;
|
||||
registerChromePackage($jar_file, $file_dest, $dest_path, $jars, $chrome_type, $pkg_name);
|
||||
}
|
||||
|
||||
addToJarFile($jar_id, $jar_man_dir, $file_src, $full_jar_path, $file_dest, $override, $jars);
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: bad jar.mn format at $line\n";
|
||||
}
|
||||
}
|
||||
elsif ($line =~ /^\s*$/ ) # blank line
|
||||
{
|
||||
if ($jar_file ne "") #if a jar file is open, close it
|
||||
{
|
||||
closeJarFile($full_jar_path, $jars);
|
||||
|
||||
$jar_file = "";
|
||||
$full_jar_path = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
|
||||
if ($jar_file ne "") #if a jar file is open, close it
|
||||
{
|
||||
closeJarFile($full_jar_path, $jars);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -1,228 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::MacCVS;
|
||||
|
||||
# package Mac::Apps::MacCVS; this should really be the name of the package
|
||||
# but due to our directory hierarchy in mozilla, I am not doing it
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
|
||||
use Cwd;
|
||||
|
||||
use File::Basename;
|
||||
|
||||
use Mac::StandardFile;
|
||||
use Mac::AppleEvents;
|
||||
use Mac::AppleEvents::Simple;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(new describe checkout update);
|
||||
$VERSION = "1.00";
|
||||
|
||||
# If you want to understand the gobbldeygook that's used to build Apple Events,
|
||||
# you should start by reading the AEGizmos documentation.
|
||||
|
||||
|
||||
# Architecture:
|
||||
# cvs session object:
|
||||
# name - session name
|
||||
# session_file - session file
|
||||
#
|
||||
#
|
||||
|
||||
my($last_error) = 0;
|
||||
my($gAppSig) = 'Mcvs'; # MacCVS Pro
|
||||
|
||||
#
|
||||
# utility routines
|
||||
#
|
||||
|
||||
|
||||
sub _checkForEventError($)
|
||||
{
|
||||
my($evt) = @_;
|
||||
|
||||
if ($evt->{ERRNO} != 0)
|
||||
{
|
||||
print STDERR "Error. Script returned '$evt->{ERROR} (error $evt->{ERRNO})\n";
|
||||
$last_error = $evt->{ERRNO};
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1; # success
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Session object methods
|
||||
#
|
||||
|
||||
sub new
|
||||
{
|
||||
my ( $proto, $session_file) = @_;
|
||||
my $class = ref($proto) || $proto;
|
||||
my $self = {};
|
||||
|
||||
if ( defined($session_file) && ( -e $session_file) )
|
||||
{
|
||||
$self->{"name"} = basename( $session_file );
|
||||
$self->{"session_file"} = $session_file;
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "MacCVS->new cvs file < $session_file > does not exist\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# makes sure that the session is open
|
||||
# assertSessionOpen()
|
||||
# returns 1 on success
|
||||
sub assertSessionOpen()
|
||||
{
|
||||
my ($self) = shift;
|
||||
|
||||
$last_error = 0;
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}";
|
||||
|
||||
my($evt) = do_event(qw/aevt odoc/, $gAppSig, $prm, $self->{session_file});
|
||||
return _checkForEventError($evt);
|
||||
}
|
||||
|
||||
# prints the cvs object, used mostly for debugging
|
||||
sub describe
|
||||
{
|
||||
my($self) = shift;
|
||||
$last_error = 0;
|
||||
print "MacCVS:: name: ", $self->{name}, " session file: ", $self->{session_file}, "\n";
|
||||
}
|
||||
|
||||
# checkout( self, module, revision, date)
|
||||
# MacCVS checkout command
|
||||
# returns 1 on success.
|
||||
sub checkout()
|
||||
{
|
||||
my($self, $module, $revision, $date ) = @_;
|
||||
unless( defined ($module) ) { $module = ""; } # get rid of the pesky undefined warnings
|
||||
unless( defined ($revision) ) { $revision = ""; }
|
||||
unless( defined ($date) ) { $date = ""; }
|
||||
|
||||
$last_error = 0;
|
||||
|
||||
$self->assertSessionOpen() || die "Error: failed to open MacCVS session file at $self->{session_file}\n";
|
||||
|
||||
my($revstring) = ($revision ne "") ? $revision : "(none)";
|
||||
my($datestring) = ($date ne "") ? $date : "(none)";
|
||||
|
||||
print "Checking out $module with revision $revstring, date $datestring\n";
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(docu), seld:TEXT(@), from:'null'()}, ".
|
||||
q"modl:'TEXT'(@), tagr:'TEXT'(@), tagd:'TEXT'(@) ";
|
||||
|
||||
my($evt) = do_event(qw/MCvs cout/, $gAppSig, $prm, $self->{name}, $module, $revision, $date);
|
||||
return _checkForEventError($evt);
|
||||
}
|
||||
|
||||
|
||||
# update( self, branch tag, list of paths)
|
||||
# MacCVS udate command
|
||||
# returns 1 on success.
|
||||
# NOTE: MacCVS Pro does not correctly support this stuff yet (as of version 2.7d5).
|
||||
sub update()
|
||||
{
|
||||
my($self, $branch, $paths ) = @_;
|
||||
|
||||
$last_error = 0;
|
||||
|
||||
$self->assertSessionOpen() || die "Error: failed to open MacCVS session file at $self->{session_file}\n";
|
||||
|
||||
if ($branch eq "HEAD") {
|
||||
$branch = "";
|
||||
}
|
||||
|
||||
my($paths_list) = "";
|
||||
|
||||
my($path);
|
||||
foreach $path (@$paths)
|
||||
{
|
||||
if ($paths_list ne "") {
|
||||
$paths_list = $paths_list.", ";
|
||||
}
|
||||
|
||||
$paths_list = $paths_list."Ò".$path."Ó";
|
||||
}
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(docu), seld:TEXT(@), from:'null'()}, ".
|
||||
q"tagr:'TEXT'(@), tFls:[";
|
||||
|
||||
$prm = $prm.$paths_list."]";
|
||||
|
||||
my($evt) = do_event(qw/MCvs updt/, $gAppSig, $prm, $self->{name}, $branch);
|
||||
return _checkForEventError($evt);
|
||||
};
|
||||
|
||||
|
||||
sub getLastError()
|
||||
{
|
||||
return $last_error;
|
||||
}
|
||||
|
||||
1;
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MacCVS - Interface to MacCVS
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MacCVS;
|
||||
$session = MacCVS->new( <session_file_path>) || die "cannot create session";
|
||||
$session->checkout([module] [revision] [date]) || die "Could not check out";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a MacCVS interface for talking to MacCVS Pro client.
|
||||
MacCVSSession is the class used to manipulate the session
|
||||
|
||||
=item new
|
||||
MacCVS->new( <cvs session file path>);
|
||||
|
||||
Creates a new session. Returns undef on failure.
|
||||
|
||||
=item checkout( <module> [revision] [date] )
|
||||
|
||||
cvs checkout command. Revision and date are optional
|
||||
returns 0 on failure
|
||||
|
||||
=cut
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
=over
|
||||
|
||||
=item MacCVS Home Page
|
||||
|
||||
http://www.maccvs.org/
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Aleks Totic atotic@netscape.com
|
||||
Simon Fraser sfraser@netscape.com
|
||||
|
||||
=cut
|
||||
|
||||
__END__
|
||||
@@ -1,603 +0,0 @@
|
||||
=head1 NAME
|
||||
|
||||
B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular
|
||||
activities related to building Mozilla
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Moz;
|
||||
|
||||
OpenErrorLog(":::BuildLog");
|
||||
StopForErrors();
|
||||
|
||||
$Moz::QUIET = 1;
|
||||
InstallFromManifest(":projects:MANIFEST", $dist_dir);
|
||||
|
||||
BuildProjectClean(":projects:SomeProject.mcp", "SomeTarget");
|
||||
MakeAlias(":projects:SomeProject.shlb", $dist_dir);
|
||||
|
||||
DontStopForErrors();
|
||||
|
||||
BuildProject(":projects:SomeOtherProject.mcp", "SomeTarget");
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<Moz> comprises the routines needed to slap CodeWarrior around, force it
|
||||
to build a sequence of projects, report the results, and a few other things.
|
||||
This module should only contain functions that are generic to any build,
|
||||
not just the Mozilla build.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
package Moz::Moz;
|
||||
require Exporter;
|
||||
|
||||
use Cwd;
|
||||
|
||||
use File::Copy;
|
||||
use File::Path;
|
||||
use File::Basename;
|
||||
|
||||
use Mac::Types;
|
||||
use Mac::Events;
|
||||
use Mac::Processes;
|
||||
|
||||
use ExtUtils::Manifest 'maniread';
|
||||
|
||||
use Moz::CodeWarriorLib;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
|
||||
@EXPORT = qw( LaunchCodeWarrior
|
||||
GetCodeWarriorRelativePath
|
||||
current_directory
|
||||
full_path_to
|
||||
DoBuildProject
|
||||
ImportXMLProject
|
||||
ExportProjectToXML
|
||||
OpenErrorLog
|
||||
MakeAlias
|
||||
GetFileModDate
|
||||
StopForErrors
|
||||
DontStopForErrors
|
||||
InstallFromManifest
|
||||
InstallResources
|
||||
RedirectOutputToFile
|
||||
Delay
|
||||
ActivateApplication
|
||||
IsProcessRunning);
|
||||
|
||||
@EXPORT_OK = qw(CloseErrorLog QUIET);
|
||||
|
||||
|
||||
sub current_directory()
|
||||
{
|
||||
my $current_directory = cwd();
|
||||
chop($current_directory) if ( $current_directory =~ m/:$/ );
|
||||
return $current_directory;
|
||||
}
|
||||
|
||||
sub full_path_to($)
|
||||
{
|
||||
my ($path) = @_;
|
||||
if ( $path =~ m/^[^:]+$/ )
|
||||
{
|
||||
$path = ":" . $path;
|
||||
}
|
||||
|
||||
if ( $path =~ m/^:/ )
|
||||
{
|
||||
$path = current_directory() . $path;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
$logging = 0;
|
||||
$recent_errors_file = "";
|
||||
$stop_on_1st_error = 1;
|
||||
$QUIET = 0;
|
||||
|
||||
|
||||
|
||||
=head2 Logging all the errors and warnings - C<OpenErrorLog($log_file)>, C<CloseErrorLog()>
|
||||
|
||||
The warnings and errors generated in the course of building projects can be logged to a file.
|
||||
Tinderbox uses this facility to show why a remote build failed.
|
||||
|
||||
Logging is off by default.
|
||||
Start logging at any point in your build process with C<OpenErrorLog($log_file)>.
|
||||
Stop with C<CloseErrorLog()>.
|
||||
You never need to close the log explicitly, unless you want to just log a couple of projects in the middle of a big list.
|
||||
C<CloseErrorLog()> is not exported by default.
|
||||
|
||||
=cut
|
||||
|
||||
sub CloseErrorLog()
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
close(ERROR_LOG);
|
||||
$logging = 0;
|
||||
StopForErrors() if $stop_on_1st_error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub OpenErrorLog($)
|
||||
{
|
||||
my ($log_file) = @_;
|
||||
|
||||
CloseErrorLog();
|
||||
if ( $log_file )
|
||||
{
|
||||
$log_file = full_path_to($log_file);
|
||||
|
||||
open(ERROR_LOG, ">$log_file") || die "Error: Can't open $log_file\n";
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $log_file);
|
||||
|
||||
$log_file =~ m/.+:(.+)/;
|
||||
$recent_errors_file = full_path_to("$1.part");
|
||||
$logging = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=head2 Stopping before it's too late - C<StopForErrors()>, C<DontStopForErrors()>
|
||||
|
||||
When building a long list of projects, you decide whether to continue building subsequent projects when one fails.
|
||||
By default, your build script will C<die> after the first project that generates an error while building.
|
||||
Change this behavior with C<DontStopForErrors()>.
|
||||
Re-enable it with C<StopForErrors()>.
|
||||
|
||||
=cut
|
||||
|
||||
sub StopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 1;
|
||||
|
||||
# Can't stop for errors unless we notice them.
|
||||
# Can't notice them unless we are logging.
|
||||
# If the user didn't explicitly request logging, log to a temporary file.
|
||||
|
||||
if ( ! $recent_errors_file )
|
||||
{
|
||||
OpenErrorLog("${TMPDIR}BuildResults");
|
||||
}
|
||||
}
|
||||
|
||||
sub DontStopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 0;
|
||||
}
|
||||
|
||||
sub log_message($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
print ERROR_LOG $message;
|
||||
}
|
||||
}
|
||||
|
||||
sub log_message_with_time($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
my $time_stamp = localtime();
|
||||
log_message("$message ($time_stamp)\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub log_recent_errors($)
|
||||
{
|
||||
my ($project_name) = @_;
|
||||
my $found_errors = 0;
|
||||
|
||||
if ( $logging )
|
||||
{
|
||||
open(RECENT_ERRORS, "<$recent_errors_file");
|
||||
|
||||
while( <RECENT_ERRORS> )
|
||||
{
|
||||
if ( /^Error/ || /^CouldnÕt find project file/ || /^Link Error/ )
|
||||
{
|
||||
# if (!$found_errors)
|
||||
# print $_;
|
||||
$found_errors = 1;
|
||||
}
|
||||
print ERROR_LOG $_;
|
||||
}
|
||||
|
||||
close(RECENT_ERRORS);
|
||||
unlink("$recent_errors_file");
|
||||
}
|
||||
|
||||
if ( $stop_on_1st_error && $found_errors )
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Errors encountered building \"$project_name\".\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub DoBuildProject($$$)
|
||||
{
|
||||
my ($project_path, $target_name, $clean_build) = @_;
|
||||
$project_path = full_path_to($project_path);
|
||||
|
||||
# $project_path =~ m/.+:(.+)/;
|
||||
# my $project_name = $1;
|
||||
|
||||
log_message_with_time("### Building \"$project_path\"");
|
||||
|
||||
# Check that the given project exists
|
||||
if (! -e $project_path)
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Can't find project file \"$project_path\".\n";
|
||||
}
|
||||
|
||||
print "Building \"$project_path\[$target_name\]\"\n";
|
||||
|
||||
$had_errors = Moz::CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
WaitNextEvent();
|
||||
|
||||
# $had_errors =
|
||||
#MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
|
||||
# tell (load script file "$CodeWarriorLib") to BuildProject("$project_path", "$project_name", "$target_name", "$recent_errors_file", $clean_build)
|
||||
#END_OF_APPLESCRIPT
|
||||
|
||||
# Append any errors to the globally accumulated log file
|
||||
# if ( $had_errors ) # Removed this test, because we want warnings, too. -- jrm
|
||||
{
|
||||
log_recent_errors($project_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub ImportXMLProject($$)
|
||||
{
|
||||
my ($xml_path, $project_path) = @_;
|
||||
|
||||
# my ($codewarrior_ide_name) = Moz::CodeWarriorLib::getCodeWarriorIDEName();
|
||||
# my $ascript = <<EOS;
|
||||
# tell application "$codewarrior_ide_name"
|
||||
# make new (project document) as ("$project_path") with data ("$xml_path")
|
||||
# end tell
|
||||
#EOS
|
||||
# print $ascript."\n";
|
||||
# my($result) = MacPerl::DoAppleScript($ascript);
|
||||
# unless ($result) { die "Error: ImportXMLProject AppleScript failed $^E $result\n"; }
|
||||
#
|
||||
|
||||
my($import_error) = Moz::CodeWarriorLib::import_project($xml_path, $project_path);
|
||||
if ($import_error ne "") {
|
||||
die "Error: ImportXMLProject failed with error $import_error\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub ExportProjectToXML($$)
|
||||
{
|
||||
my ($project_path, $xml_path) = @_;
|
||||
|
||||
my (@suffix_list) = (".mcp");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
|
||||
if ($suffix eq "") { die "Project: $project_path doesn't look like a project file.\n"; }
|
||||
|
||||
if (-e $xml_path) {
|
||||
print "$xml_path exists - not exporting $project_path\n";
|
||||
}
|
||||
else {
|
||||
print "Exporting $project_path to $xml_path\n";
|
||||
my($export_error) = Moz::CodeWarriorLib::export_project($project_path, $xml_path);
|
||||
if ($export_error ne "") {
|
||||
die "Error: export_project failed with error '$export_error'\n";
|
||||
}
|
||||
|
||||
if (! -e $xml_path) {
|
||||
die "Error: XML export to $xml_path failed\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=head2 Miscellaneous
|
||||
|
||||
C<MakeAlias($old_file, $new_file)> functions like C<symlink()>, except with better argument defaulting and more explicit error messages.
|
||||
|
||||
=cut
|
||||
|
||||
sub MakeAlias($$)
|
||||
{
|
||||
my ($old_file, $new_file) = @_;
|
||||
|
||||
# if the directory to hold $new_file doesn't exist, create it
|
||||
if ( ($new_file =~ m/(.+:)/) && !-d $1 )
|
||||
{
|
||||
mkpath($1);
|
||||
}
|
||||
|
||||
# if a leaf name wasn't specified for $new_file, use the leaf from $old_file
|
||||
if ( ($new_file =~ m/:$/) && ($old_file =~ m/.+:(.+)/) )
|
||||
{
|
||||
$new_file .= $1;
|
||||
}
|
||||
|
||||
my $message = "Can't create a Finder alias (at \"$new_file\")\n for \"$old_file\"; because ";
|
||||
|
||||
die "Error: $message \"$old_file\" doesn't exist.\n" unless -e $old_file;
|
||||
die "Error: $message I won't replace an existing (non-alias) file with an alias.\n" if ( -e $new_file && ! -l $new_file );
|
||||
|
||||
# now: $old_file exists; $new_file doesn't (or else, is an alias already)
|
||||
|
||||
if ( -l $new_file )
|
||||
{
|
||||
# ...then see if it already points to $old_file
|
||||
my $current_target = full_path_to(readlink($new_file));
|
||||
my $new_target = full_path_to($old_file);
|
||||
|
||||
return if ( $current_target eq $new_target );
|
||||
# if the desired alias already exists and points to the right thing, then we're done
|
||||
|
||||
unlink $new_file;
|
||||
}
|
||||
|
||||
symlink($old_file, $new_file) || die "Error: $message symlink returned an unexpected error.\n";
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
C<InstallFromManifest()>
|
||||
|
||||
=cut
|
||||
|
||||
sub InstallFromManifest($;$$)
|
||||
{
|
||||
my ($manifest_file, $dest_dir, $flat) = @_;
|
||||
|
||||
$flat = 0 unless defined($flat); # if $flat, all rel. paths in MANIFEST get aliased to the root of $dest_dir
|
||||
|
||||
$dest_dir ||= ":";
|
||||
|
||||
$manifest_file =~ m/(.+):/;
|
||||
my $source_dir = $1;
|
||||
|
||||
chop($dest_dir) if $dest_dir =~ m/:$/;
|
||||
|
||||
#Mac::Events->import();
|
||||
WaitNextEvent();
|
||||
if ($flat)
|
||||
{
|
||||
print "Doing manifest on \"$manifest_file\" FLAT\n" unless $QUIET;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Doing manifest on \"$manifest_file\"\n" unless $QUIET;
|
||||
}
|
||||
|
||||
my $read = maniread(full_path_to($manifest_file));
|
||||
foreach $file (keys %$read)
|
||||
{
|
||||
next unless $file;
|
||||
|
||||
$subdir = ":";
|
||||
if (!$flat && ($file =~ /:.+:/ ))
|
||||
{
|
||||
$subdir = $&;
|
||||
}
|
||||
|
||||
$file = ":$file" unless $file =~ m/^:/;
|
||||
MakeAlias("$source_dir$file", "$dest_dir$subdir");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
C<InstallResources()>
|
||||
|
||||
=cut
|
||||
|
||||
# parameters are path to MANIFEST file, destination dir, true (to make copies) or false (to make aliases)
|
||||
sub InstallResources($;$;$)
|
||||
{
|
||||
my ($manifest_file, $dest_dir, $copy_files) = @_;
|
||||
|
||||
$dest_dir ||= ":";
|
||||
mkpath($dest_dir) if !-d $dest_dir;
|
||||
|
||||
$manifest_file =~ m/(.+):/;
|
||||
my $source_dir = $1;
|
||||
|
||||
chop($dest_dir) if $dest_dir =~ m/:$/;
|
||||
|
||||
WaitNextEvent();
|
||||
print "Installing resources from \"$manifest_file\"\n" unless $QUIET;
|
||||
|
||||
my $read = maniread(full_path_to($manifest_file));
|
||||
foreach $file (keys %$read)
|
||||
{
|
||||
next unless $file;
|
||||
|
||||
if ($copy_files)
|
||||
{
|
||||
copy("$source_dir:$file", "$dest_dir:$file");
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAlias("$source_dir:$file", "$dest_dir:$file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Delay
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub Delay($)
|
||||
{
|
||||
my ($delay_seconds) = @_;
|
||||
|
||||
$now = time;
|
||||
|
||||
$exit_time = $now + $delay_seconds;
|
||||
|
||||
while ($exit_time > $now) {
|
||||
$now = time;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetFileModDate
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetFileModDate($)
|
||||
{
|
||||
my($filePath)=@_;
|
||||
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
|
||||
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath);
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// LaunchCodeWarrior
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub LaunchCodeWarrior($)
|
||||
{
|
||||
my($idepath_file) = @_; # full path to IDE location file
|
||||
my($cur_dir) = cwd();
|
||||
|
||||
# this both launches and writes the IDE path file
|
||||
Moz::CodeWarriorLib::activate($idepath_file);
|
||||
|
||||
chdir($cur_dir);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetCodeWarriorRelativePath
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetCodeWarriorRelativePath($)
|
||||
{
|
||||
my($rel_path) = @_;
|
||||
return Moz::CodeWarriorLib::getCodeWarriorPath($rel_path);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RedirectOutputToFile
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RedirectOutputToFile($)
|
||||
{
|
||||
my($log_file) = @_;
|
||||
|
||||
# ensure that folders in the path exist
|
||||
my($logdir) = "";
|
||||
my($logfile) = $log_file;
|
||||
|
||||
if ($log_file =~ /(.+?:)([^:]+)$/) # ? for non-greedy match
|
||||
{
|
||||
$logdir = $1;
|
||||
$logfile = $2;
|
||||
|
||||
mkpath($logdir);
|
||||
}
|
||||
|
||||
print "Output is now being redirected to the file '$log_file'\n";
|
||||
|
||||
open(STDOUT, "> $log_file") || die "Can't redirect stdout";
|
||||
open(STDERR, ">&STDOUT") || die "Can't dup stdout";
|
||||
select(STDERR); $| = 1; # make unbuffered
|
||||
select(STDOUT); $| = 1; # make unbuffered
|
||||
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $log_file);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ActivateApplication
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub ActivateApplication($)
|
||||
{
|
||||
my ($appSignature) = @_;
|
||||
my ($psi, $found);
|
||||
my ($appPSN);
|
||||
|
||||
$found = 0;
|
||||
|
||||
foreach $psi (values(%Process))
|
||||
{
|
||||
if ($psi->processSignature() eq $appSignature)
|
||||
{
|
||||
$appPSN = $psi->processNumber();
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found == 0 || SameProcess($appPSN, GetFrontProcess()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetFrontProcess($appPSN);
|
||||
|
||||
while (GetFrontProcess() != $appPSN)
|
||||
{
|
||||
WaitNextEvent();
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// IsProcessRunning
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub IsProcessRunning($)
|
||||
{
|
||||
my($processName, $psn, $psi) = @_;
|
||||
while ( ($psn, $psi) = each(%Process) ) {
|
||||
if ($psi->processName eq $processName) { return 1; }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Scott Collins <scc@netscape.com>, Simon Fraser <sfraser@netscape.com>, Chris Yeh <cyeh@netscape.com>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildMozillaDebug.pl (et al), BuildList.pm, CodeWarriorLib (an AppleScript library)
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
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 Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
=cut
|
||||
@@ -1,272 +0,0 @@
|
||||
|
||||
package Moz::Prefs;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that attempts to read a file from the Preferences folder,
|
||||
# and get build settings out of it
|
||||
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use File::Path;
|
||||
|
||||
use Mac::Files;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(ReadMozUserPrefs);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# GetPrefsFolder
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub GetPrefsFolder()
|
||||
{
|
||||
my($prefs_folder) = FindFolder(kOnSystemDisk, kPreferencesFolderType, 1);
|
||||
return $prefs_folder.":Mozilla build prefs";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# SetArrayValue
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetArrayValue($$$)
|
||||
{
|
||||
my($array_ref, $index1, $index2) = @_;
|
||||
|
||||
my($index);
|
||||
foreach $index (@$array_ref)
|
||||
{
|
||||
if ($index->[0] eq $index1)
|
||||
{
|
||||
$index->[1] = $index2;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# WriteDefaultPrefsFile
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub WriteDefaultPrefsFile($)
|
||||
{
|
||||
my($file_path) = @_;
|
||||
|
||||
my($file_contents);
|
||||
$file_contents = <<'EOS';
|
||||
% You can use this file to customize the Mozilla build system.
|
||||
% The following kinds of lines are allowable:
|
||||
% Comment lines, which start with a '%' in the first column
|
||||
% Lines which modify the default build settings. For the list of flags,
|
||||
% see MozBuildFlags.pm. Examples are:
|
||||
%
|
||||
% build pull 0 % don't pull
|
||||
% options mng 1 % turn mng on
|
||||
%
|
||||
% Line containing the special 'buildfrom' flag, which specifies
|
||||
% where to start the build. Example:
|
||||
%
|
||||
% buildfrom nglayout % where to start the build
|
||||
%
|
||||
% Lines which specify the location of the files used to store paths
|
||||
% to the CodeWarrior IDE, and the MacCVS Pro session file. Note quoting
|
||||
% of paths containing whitespace. Examples:
|
||||
%
|
||||
% filepath idepath ::codewarrior.txt
|
||||
% filepath sessionpath ":Some folder:MacCVS session path.txt"
|
||||
%
|
||||
% Lines which modify the build settings like %main::DEBUG.
|
||||
% Any lines which do not match either of the above are assumed
|
||||
% to set variables on $main::. Examples:
|
||||
%
|
||||
% MOZILLA_OFFICIAL 1
|
||||
%
|
||||
EOS
|
||||
|
||||
$file_contents =~ s/%/#/g;
|
||||
|
||||
local(*PREFS_FILE);
|
||||
|
||||
open(PREFS_FILE, "> $file_path") || die "Could not write default prefs file\n";
|
||||
print PREFS_FILE ($file_contents);
|
||||
close(PREFS_FILE);
|
||||
|
||||
MacPerl::SetFileInfo("McPL", "TEXT", $file_path);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# HandlePrefSet
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub HandlePrefSet($$$$)
|
||||
{
|
||||
my($flags, $name, $value, $desc) = @_;
|
||||
|
||||
if (SetArrayValue($flags, $name, $value)) {
|
||||
print "Prefs set $desc flag '$name' to '$value'\n";
|
||||
} else {
|
||||
die "$desc setting '$name' is not a valid option\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# HandleBuildFromPref
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub HandleBuildFromPref($$)
|
||||
{
|
||||
my($build_array, $name) = @_;
|
||||
|
||||
my($setting) = 0;
|
||||
my($index);
|
||||
foreach $index (@$build_array)
|
||||
{
|
||||
if ($index->[0] eq $name) {
|
||||
$setting = 1;
|
||||
}
|
||||
|
||||
$index->[1] = $setting;
|
||||
}
|
||||
|
||||
if ($setting == 1) {
|
||||
print "Building from $name onwards, as specified by prefs\n";
|
||||
} else {
|
||||
printf "Failed to find buildfrom setting '$name'\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# ReadPrefsFile
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadPrefsFile($$$$$)
|
||||
{
|
||||
my($file_path, $build_flags, $options_flags, $filepath_flags, $create_if_missing) = @_;
|
||||
|
||||
local(*PREFS_FILE);
|
||||
|
||||
if (open(PREFS_FILE, "< $file_path"))
|
||||
{
|
||||
print "Reading build prefs from '$file_path'\n";
|
||||
|
||||
while (<PREFS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) { # ignore comments and empty lines
|
||||
next;
|
||||
}
|
||||
|
||||
if (($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\"(.+)\"(\s+#.+)?/) ||
|
||||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\'(.+)\'(\s+#.+)?/) ||
|
||||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+([^#\s]+)(\s+#.+)?/))
|
||||
{
|
||||
my($array_name) = $1;
|
||||
my($option_name) = $2;
|
||||
my($option_value) = $3;
|
||||
|
||||
# print "Read '$array_name' '$option_name' '$option_value'\n";
|
||||
|
||||
if ($array_name eq "build")
|
||||
{
|
||||
HandlePrefSet($build_flags, $option_name, $option_value, "Build");
|
||||
}
|
||||
elsif ($array_name eq "options")
|
||||
{
|
||||
HandlePrefSet($options_flags, $option_name, $option_value, "Options");
|
||||
}
|
||||
elsif ($array_name eq "filepath" && $option_name && $option_value)
|
||||
{
|
||||
HandlePrefSet($filepath_flags, $option_name, $option_value, "Filepath");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Unknown pref option at $line\n";
|
||||
}
|
||||
}
|
||||
elsif ($line =~ /^\s*buildfrom\s+([^#\s]+)(\s+#.+)?/)
|
||||
{
|
||||
my($build_start) = $1;
|
||||
HandleBuildFromPref($build_flags, $build_start);
|
||||
}
|
||||
elsif ($line =~ /^\s*([^#\s]+)\s+([^#\s]+)(\s+#.+)?/)
|
||||
{
|
||||
my($build_var) = $1;
|
||||
my($var_setting) = $2;
|
||||
|
||||
print "Setting \$main::$build_var to $var_setting\n";
|
||||
eval "\$main::$build_var = \"$var_setting\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Unrecognized input line at $line\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(PREFS_FILE);
|
||||
}
|
||||
elsif ($create_if_missing)
|
||||
{
|
||||
print "No prefs file found at $file_path; using defaults\n";
|
||||
|
||||
my($folder_path) = $file_path;
|
||||
$folder_path =~ s/[^:]+$//;
|
||||
mkpath($folder_path);
|
||||
WriteDefaultPrefsFile($file_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# ReadMozUserPrefs
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadMozUserPrefs($$$$)
|
||||
{
|
||||
my($prefs_file_name, $build_flags, $options_flags, $filepath_flags) = @_;
|
||||
|
||||
if ($prefs_file_name eq "") { return; }
|
||||
|
||||
# if local prefs exist, just use those. Othewise, look in the prefs folder
|
||||
if (-e $prefs_file_name)
|
||||
{
|
||||
# read local prefs
|
||||
ReadPrefsFile($prefs_file_name, $build_flags, $options_flags, $filepath_flags, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
# first read prefs folder prefs
|
||||
my($prefs_path) = GetPrefsFolder();
|
||||
$prefs_path .= ":$prefs_file_name";
|
||||
|
||||
ReadPrefsFile($prefs_path, $build_flags, $options_flags, $filepath_flags, 1);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -1,932 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
package Moz::ProjectXML;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use Cwd;
|
||||
use XML::DOM;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
ParseXMLDocument
|
||||
DisposeXMLDocument
|
||||
WriteXMLDocument
|
||||
CleanupPro5XML
|
||||
GetTargetsList
|
||||
CloneTarget
|
||||
SetAsSharedLibraryTarget
|
||||
SetAsStaticLibraryTarget
|
||||
AddTarget
|
||||
RemoveTarget
|
||||
GetTargetSetting
|
||||
SetTargetSetting
|
||||
getChildElementTextContents
|
||||
);
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# A module for reading, manipulating, and writing XML-format CodeWarrior project files.
|
||||
#
|
||||
# Sample usage:
|
||||
#
|
||||
# use ProjectXML;
|
||||
#
|
||||
# my $doc = ProjectXML::ParseXMLDocument("Test.mcp.xml");
|
||||
# ProjectXML::CloneTarget($doc, "Test.shlb", "Test.lib");
|
||||
# ProjectXML::SetAsStaticLibraryTarget($doc, "Test.lib", "TestOutput.lib");
|
||||
# ProjectXML::WriteXMLDocument($doc, "Test_out.xml");
|
||||
# ProjectXML::DisposeXMLDocument($doc);
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ParseXMLDocument
|
||||
#// Note that the caller must call DisposeXMLDocument on the returned doc
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ParseXMLDocument($)
|
||||
{
|
||||
my($doc_path) = @_;
|
||||
|
||||
my $parser = new XML::DOM::Parser(ErrorContext => 2);
|
||||
my $doc = $parser->parsefile($doc_path);
|
||||
|
||||
return $doc;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// DisposeXMLDocument
|
||||
#// Needed to avoid memory leaks - cleanup circular references for garbage collection
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub DisposeXMLDocument($)
|
||||
{
|
||||
my($doc) = @_;
|
||||
|
||||
$doc->dispose();
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// WriteXMLDocument
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub _pro5_tag_compression($$)
|
||||
{
|
||||
return 1; # Pro 5 is broken and can't import XML with <foo/> style tags
|
||||
}
|
||||
|
||||
sub _pro6plus_tag_compression($$)
|
||||
{
|
||||
return 0; # Pro 6 can deal with empty XML tags like <foo/>
|
||||
}
|
||||
|
||||
sub WriteXMLDocument($$$)
|
||||
{
|
||||
my($doc, $file_path, $ide_version) = @_;
|
||||
|
||||
if ($ide_version eq "4.0")
|
||||
{
|
||||
XML::DOM::setTagCompression(\&_pro5_tag_compression);
|
||||
}
|
||||
else
|
||||
{
|
||||
XML::DOM::setTagCompression(\&_pro6plus_tag_compression);
|
||||
}
|
||||
|
||||
$doc->printToFile($file_path);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// CleanupPro5XML
|
||||
#// XML Projects exported by Pro 5 contain garbage data under the MWMerge_MacOS_skipResources
|
||||
#// setting. This routine cleans this up, saving the result to a new file
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CleanupPro5XML($$)
|
||||
{
|
||||
my($xml_path, $out_path) = @_;
|
||||
|
||||
local(*XML_FILE);
|
||||
open(XML_FILE, "< $xml_path") || die "Error: failed to open file $xml_path\n";
|
||||
|
||||
local(*CLEANED_FILE);
|
||||
open(CLEANED_FILE, "> $out_path") || die "Error: failed to open file $out_path for writing\n";
|
||||
|
||||
my $in_skip_resources_settings = 0;
|
||||
|
||||
while(<XML_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
|
||||
if ($line =~ /^<\?codewarrior/) # is processing inst line
|
||||
{
|
||||
my $test_line = $line;
|
||||
chomp($test_line);
|
||||
|
||||
my $out_line = $test_line;
|
||||
if ($test_line =~ /^<\?codewarrior\s+exportversion=\"(.+)\"\s+ideversion=\"(.+)\"\s*\?>$/)
|
||||
{
|
||||
my $export_version = $1;
|
||||
my $ide_version = $2;
|
||||
|
||||
$ide_version = "4.0_mozilla"; # pseudo IDE version so we know we touched it
|
||||
$out_line = "<?codewarrior exportversion=\"".$export_version."\" ideversion=\"".$ide_version."\"?>";
|
||||
}
|
||||
|
||||
print CLEANED_FILE "$out_line\n";
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~ /MWMerge_MacOS_skipResources/)
|
||||
{
|
||||
$in_skip_resources_settings = 1;
|
||||
print CLEANED_FILE "$line";
|
||||
}
|
||||
elsif($in_skip_resources_settings && $line =~ /<!-- Settings for/)
|
||||
{
|
||||
# leaving bad settings lines. Write closing tag
|
||||
print CLEANED_FILE " <!-- Corrupted setting entries removed by script -->\n";
|
||||
print CLEANED_FILE " </SETTING>\n\n";
|
||||
|
||||
print CLEANED_FILE "$line";
|
||||
|
||||
$in_skip_resources_settings = 0;
|
||||
}
|
||||
elsif (!$in_skip_resources_settings)
|
||||
{
|
||||
print CLEANED_FILE "$line";
|
||||
}
|
||||
}
|
||||
|
||||
close(XML_FILE);
|
||||
close(CLEANED_FILE);
|
||||
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# SniffProjectXMLIDEVersion
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub SniffProjectXMLIDEVersion($)
|
||||
{
|
||||
my($xml_path) = @_;
|
||||
|
||||
my $found_version = "";
|
||||
|
||||
local(*XML_FILE);
|
||||
open(XML_FILE, "< $xml_path") || die "Error: failed to open file $xml_path\n";
|
||||
|
||||
while(<XML_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
if ($line =~ /^<\?codewarrior/) # is processing inst line
|
||||
{
|
||||
unless ($line =~ /^<\?codewarrior\s+exportversion=\"(.+)\"\s+ideversion=\"(.+)\"\s*\?>$/)
|
||||
{
|
||||
die "Error: Failed to find ideversion in $xml_path in line $line\n";
|
||||
}
|
||||
|
||||
my $export_version = $1;
|
||||
my $ide_version = $2;
|
||||
|
||||
$found_version = $ide_version;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
close(XML_FILE);
|
||||
|
||||
return $found_version;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetsList
|
||||
#// Returns an array of target names
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetsList($)
|
||||
{
|
||||
my($doc) = @_;
|
||||
|
||||
my $nodes = $doc->getElementsByTagName("TARGET");
|
||||
my $n = $nodes->getLength;
|
||||
|
||||
my @target_names;
|
||||
|
||||
for (my $i = 0; $i < $n; $i++)
|
||||
{
|
||||
my ($node) = $nodes->item($i);
|
||||
|
||||
my($target_name) = getChildElementTextContents($node, "NAME");
|
||||
push(@target_names, $target_name);
|
||||
}
|
||||
|
||||
return @target_names;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// CloneTarget
|
||||
#// Clone the named target, renaming it to 'new_name'
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CloneTarget($$$)
|
||||
{
|
||||
my($doc, $target_name, $new_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
# clone here
|
||||
my $target_clone = $target_node->cloneNode(1); # deep clone
|
||||
|
||||
# -- munge target settings --
|
||||
|
||||
# set the target name field
|
||||
setChildElementTextContents($doc, $target_clone, "NAME", $new_name);
|
||||
|
||||
# set the targetname pref
|
||||
setTargetNodeSetting($doc, $target_clone, "Targetname", $new_name);
|
||||
|
||||
# -- insert new target subtree --
|
||||
|
||||
my $target_list = $target_node->getParentNode();
|
||||
$target_list->appendChild($target_clone);
|
||||
|
||||
# -- now add to targetorder --
|
||||
my (@target_order_nodes) = getChildOfDocument($doc, "TARGETORDER");
|
||||
|
||||
my $target_order = @target_order_nodes[0];
|
||||
|
||||
my $new_order = $doc->createElement("ORDEREDTARGET");
|
||||
my $order_name = $doc->createElement("NAME");
|
||||
|
||||
$new_order->appendChild($order_name);
|
||||
|
||||
setChildElementTextContents($doc, $new_order, "NAME", $new_name);
|
||||
$target_order->appendChild($new_order);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetAsSharedLibraryTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetAsSharedLibraryTarget($$$)
|
||||
{
|
||||
my($doc, $target_name, $output_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_type", "SharedLibrary");
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_filetype", "1936223330"); #'shlb'
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_outfile", $output_name);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// AddFileToTarget
|
||||
#//
|
||||
#// Add a file to the specified target(s).
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub AddFileToTarget($$$)
|
||||
{
|
||||
my($doc, $target_list, $file_name) = @_;
|
||||
|
||||
# the file must be added in 3 places:
|
||||
# 1. in <TARGET><FILELIST><FILE> (with linkage flags if necessary)
|
||||
# 2. in <TARGET><LINKORDER><FILEREF>
|
||||
# 3. in <GROUPLIST><GROUP><FILEREF>
|
||||
die "Write me\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RemoveFileFromTarget
|
||||
#//
|
||||
#// Remove a file from the specified target, removing it from the entire project
|
||||
#// if no other targets reference it.
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RemoveFileFromTarget($$$)
|
||||
{
|
||||
my($doc, $target_node, $file_name) = @_;
|
||||
|
||||
# the file must be removed in 3 places:
|
||||
# 1. in <TARGET><FILELIST><FILE>
|
||||
# 2. in <TARGET><LINKORDER><FILEREF>
|
||||
# 3. in <GROUPLIST><GROUP><FILEREF>
|
||||
|
||||
# first, remove from <FILELIST>
|
||||
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
|
||||
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
|
||||
|
||||
my $file_node = getChildNodeByGrandchildContents($doc, $filelist_node, "FILE", "PATH", $file_name);
|
||||
unless ($file_node) { return; }
|
||||
|
||||
$filelist_node->removeChild($file_node);
|
||||
|
||||
# next, remove from <LINKORDER>
|
||||
my $linkorder_node = getFirstChildElement($target_node, "LINKORDER");
|
||||
unless ($linkorder_node) { die "Error: failed to find LINKORDER node\n"; }
|
||||
|
||||
my $fileref_node = getChildNodeByGrandchildContents($doc, $linkorder_node, "FILEREF", "PATH", $file_name);
|
||||
unless ($fileref_node) { die "Error: link order node for file $file_name not found\n"; }
|
||||
|
||||
$linkorder_node->removeChild($fileref_node);
|
||||
|
||||
# last, remove from <GROUPLIST>
|
||||
# <GROUPLIST> is cross-target, so we have to be careful here.
|
||||
my $grouplist_node = getChildOfDocument($doc, "GROUPLIST");
|
||||
unless ($grouplist_node) { die "Error: failed to find GROUPLIST node\n"; }
|
||||
|
||||
# if the file isn't in any other targets, remove it from the groups
|
||||
if (!GetFileInUse($doc, $file_name))
|
||||
{
|
||||
print "File $file_name is in no other targest. Removing from project\n";
|
||||
|
||||
my @group_nodes;
|
||||
getChildElementsOfType($doc, $grouplist_node, "GROUP", \@group_nodes);
|
||||
my $group_node;
|
||||
foreach $group_node (@group_nodes)
|
||||
{
|
||||
my @fileref_nodes;
|
||||
getChildElementsOfType($doc, $group_node, "FILEREF", \@fileref_nodes);
|
||||
|
||||
my $fileref_node;
|
||||
foreach $fileref_node (@fileref_nodes)
|
||||
{
|
||||
my $path_name = getChildElementTextContents($fileref_node, "PATH");
|
||||
if ($path_name eq $file_name)
|
||||
{
|
||||
print "Removing $file_name from project group list\n";
|
||||
$group_node->removeChild($fileref_node);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# can a file appear in more than one group?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetAsStaticLibraryTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetAsStaticLibraryTarget($$$)
|
||||
{
|
||||
my($doc, $target_name, $output_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_type", "Library");
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_filetype", "1061109567"); #'????'
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_outfile", $output_name);
|
||||
|
||||
# static targets don't need any library linkage, so we can remove linkage
|
||||
# with all .shlb and .Lib files.
|
||||
|
||||
my(@obsolete_files) = ("NSStdLibStubs", "InterfacesStubs", "InterfaceLib", "InternetConfigLib");
|
||||
|
||||
print " Removing libraries etc. from target\n";
|
||||
|
||||
# get all files in target
|
||||
my @target_files = GetTargetFilesList($doc, $target_name);
|
||||
my $target_file;
|
||||
foreach $target_file (@target_files)
|
||||
{
|
||||
if ($target_file =~ /(\.shlb|\.lib|\.Lib|\.o|\.exp)$/)
|
||||
{
|
||||
RemoveFileFromTarget($doc, $target_node, $target_file);
|
||||
}
|
||||
}
|
||||
|
||||
print " Removing stub libraries from target\n";
|
||||
|
||||
# then remove files with known names
|
||||
my $obs_file;
|
||||
foreach $obs_file (@obsolete_files)
|
||||
{
|
||||
RemoveFileFromTarget($doc, $target_node, $obs_file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// AddTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub AddTarget($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
die "Write me\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RemoveTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RemoveTarget($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
die "Write me\n";
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetSetting
|
||||
#// Get the value for the specified setting in the specified target
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetSetting($$$)
|
||||
{
|
||||
my($doc, $target_name, $setting_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
return getTargetNodeSetting($target_node, "VALUE");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetTargetSetting
|
||||
#// Set the value for the specified setting in the specified target
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetTargetSetting($$$$)
|
||||
{
|
||||
my($doc, $target_name, $setting_name, $new_value) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
setTargetNodeSetting($doc, $target_node, "VALUE", $new_value);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetFilesList
|
||||
#// Return an array of the files in the target (in filelist order)
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetFilesList($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
my @files_list;
|
||||
|
||||
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
|
||||
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
|
||||
|
||||
my @file_nodes;
|
||||
getChildElementsOfType($doc, $filelist_node, "FILE", \@file_nodes);
|
||||
|
||||
my $node;
|
||||
foreach $node (@file_nodes)
|
||||
{
|
||||
my $file_name = getChildElementTextContents($node, "PATH");
|
||||
push(@files_list, $file_name);
|
||||
}
|
||||
|
||||
return @files_list;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// FileIsInTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub FileIsInTarget($$$)
|
||||
{
|
||||
my($doc, $file_name, $target_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
unless ($target_node) { die "Error: no target found called $target_name\n"; }
|
||||
|
||||
my $file_node = GetTargetFileNode($doc, $target_node, $file_name);
|
||||
if ($file_node) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetFileTargetsList
|
||||
#// Return an array of the targets that a file is in (expensive)
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetFileTargetsList($$)
|
||||
{
|
||||
my ($doc, $file_name) = @_;
|
||||
|
||||
my @target_list;
|
||||
|
||||
my @targets = GetTargetsList($doc);
|
||||
my $target;
|
||||
|
||||
foreach $target (@targets)
|
||||
{
|
||||
if (FileIsInTarget($doc, $file_name, $target))
|
||||
{
|
||||
push(@target_list, $target);
|
||||
}
|
||||
}
|
||||
|
||||
return @target_list;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetFileNode
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetFileNode($$$)
|
||||
{
|
||||
my($doc, $target_node, $file_name) = @_;
|
||||
|
||||
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
|
||||
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
|
||||
|
||||
my $file_node = getChildNodeByGrandchildContents($doc, $filelist_node, "FILE", "PATH", $file_name);
|
||||
|
||||
return $file_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetFileInUse
|
||||
#// Return true if the file is used by any target
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetFileInUse($$)
|
||||
{
|
||||
my($doc, $file_name) = @_;
|
||||
|
||||
my $targetlist_node = getChildOfDocument($doc, "TARGETLIST");
|
||||
|
||||
my $target_node = $targetlist_node->getFirstChild();
|
||||
|
||||
while ($target_node)
|
||||
{
|
||||
if ($target_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$target_node->getTagName() eq "TARGET")
|
||||
{
|
||||
# if this is a target node
|
||||
my $file_node = GetTargetFileNode($doc, $target_node, $file_name);
|
||||
if ($file_node) {
|
||||
return 1; # found it
|
||||
}
|
||||
}
|
||||
|
||||
$target_node = $target_node->getNextSibling();
|
||||
}
|
||||
|
||||
# not found
|
||||
return 0;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildOfDocument
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getChildOfDocument($$)
|
||||
{
|
||||
my($doc, $child_type) = @_;
|
||||
|
||||
return getFirstChildElement($doc->getDocumentElement(), $child_type);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getFirstChildElement
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getFirstChildElement($$)
|
||||
{
|
||||
my($node, $element_name) = @_;
|
||||
|
||||
my $found_node;
|
||||
|
||||
unless ($node) { die "getFirstChildElement called with empty node\n"; }
|
||||
|
||||
#look for the first "element_name" child
|
||||
|
||||
my $child_node = $node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$child_node->getTagName() eq $element_name)
|
||||
{
|
||||
$found_node = $child_node;
|
||||
last;
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $found_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildElementsOfType
|
||||
#//
|
||||
#// Return an array of refs to child nodes of the given type
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getChildElementsOfType($$$$)
|
||||
{
|
||||
my($doc, $node, $child_type, $array_ref) = @_;
|
||||
|
||||
my $child_node = $node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$child_node->getTagName() eq $child_type)
|
||||
{
|
||||
push(@$array_ref, $child_node);
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildElementTextContents
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Given <FOOPY><NERD>Hi!</NERD></FOOPY>, where $node is <FOOPY>,
|
||||
# returns "Hi!". If > 1 <NERD> node, returns the contents of the first.
|
||||
#
|
||||
sub getChildElementTextContents($$)
|
||||
{
|
||||
my($node, $tag_name) = @_;
|
||||
|
||||
my $first_element = getFirstChildElement($node, $tag_name);
|
||||
my $text_node = $first_element->getFirstChild();
|
||||
|
||||
my $text_contents = "";
|
||||
|
||||
# concat adjacent text nodes
|
||||
while ($text_node)
|
||||
{
|
||||
if ($text_node->getNodeTypeName() ne "TEXT_NODE")
|
||||
{
|
||||
last;
|
||||
}
|
||||
|
||||
$text_contents = $text_contents.$text_node->getData();
|
||||
$text_node = $text_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $text_contents;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// setChildElementTextContents
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub setChildElementTextContents($$$$)
|
||||
{
|
||||
my($doc, $node, $tag_name, $contents_text) = @_;
|
||||
|
||||
my $first_element = getFirstChildElement($node, $tag_name);
|
||||
my $new_text_node = $doc->createTextNode($contents_text);
|
||||
|
||||
# replace all child elements with a text element
|
||||
removeAllChildren($first_element);
|
||||
|
||||
$first_element->appendChild($new_text_node);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildNodeByContents
|
||||
#//
|
||||
#// Consider <foo><bar><baz>Foopy</baz></bar><bar><baz>Loopy</baz></bar></foo>
|
||||
#// This function, when called with getChildNodeByContents($foonode, "bar", "baz", "Loopy")
|
||||
#// returns the second <bar> node.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getChildNodeByGrandchildContents($$$$$)
|
||||
{
|
||||
my($doc, $node, $child_type, $gc_type, $gc_contents) = @_; # gc = grandchild
|
||||
|
||||
my $found_node;
|
||||
my $child_node = $node->getFirstChild();
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$child_node->getTagName() eq $child_type)
|
||||
{
|
||||
# check for a child of this node of type
|
||||
my $child_contents = getChildElementTextContents($child_node, $gc_type);
|
||||
|
||||
if ($child_contents eq $gc_contents)
|
||||
{
|
||||
$found_node = $child_node;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $found_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getTargetNode
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getTargetNode($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
my $targetlist_node = getChildOfDocument($doc, "TARGETLIST");
|
||||
return getChildNodeByGrandchildContents($doc, $targetlist_node, "TARGET", "NAME", $target_name);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getTargetNamedSettingNode
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getTargetNamedSettingNode($$)
|
||||
{
|
||||
my($target_node, $setting_name) = @_;
|
||||
|
||||
my $setting_node;
|
||||
|
||||
my $settinglist_node = getFirstChildElement($target_node, "SETTINGLIST");
|
||||
my $child_node = $settinglist_node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName ne "ELEMENT_NODE")
|
||||
{
|
||||
$child_node = $child_node->getNextSibling();
|
||||
next;
|
||||
}
|
||||
|
||||
if ($child_node->getTagName() eq "SETTING")
|
||||
{
|
||||
my $set_name = getChildElementTextContents($child_node, "NAME");
|
||||
|
||||
if ($set_name eq $setting_name)
|
||||
{
|
||||
$setting_node = $child_node;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $setting_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getTargetNodeSetting
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getTargetNodeSetting($$)
|
||||
{
|
||||
my($target_node, $setting_name) = @_;
|
||||
|
||||
my $setting_node = getTargetNamedSettingNode($target_node, $setting_name);
|
||||
return getChildElementTextContents($setting_node, "VALUE");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// setTargetNodeSetting
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub setTargetNodeSetting($$$$)
|
||||
{
|
||||
my($doc, $target_node, $setting_name, $new_value) = @_;
|
||||
|
||||
my $setting_node = getTargetNamedSettingNode($target_node, $setting_name);
|
||||
|
||||
setChildElementTextContents($doc, $setting_node, "VALUE", $new_value);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// elementInArray
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub elementInArray($$)
|
||||
{
|
||||
my($element, $array) = @_;
|
||||
my $test;
|
||||
foreach $test (@$array)
|
||||
{
|
||||
if ($test eq $element) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// removeAllChildren
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub removeAllChildren($)
|
||||
{
|
||||
my($node) = @_;
|
||||
|
||||
my $child_node = $node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
$node->removeChild($child_node);
|
||||
$child_node = $node->getFirstChild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// dumpNodeData
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub dumpNodeData($)
|
||||
{
|
||||
my($node) = @_;
|
||||
|
||||
unless ($node) { die "Null node passed to dumpNodeData\n"; }
|
||||
|
||||
print "Dumping node $node\n";
|
||||
|
||||
my($node_type) = $node->getNodeTypeName();
|
||||
|
||||
if ($node_type eq "ELEMENT_NODE")
|
||||
{
|
||||
my($node_name) = $node->getTagName();
|
||||
print "Element $node_name\n";
|
||||
}
|
||||
elsif ($node_type eq "TEXT_NODE")
|
||||
{
|
||||
my($node_data) = $node->getData;
|
||||
# my(@node_vals) = unpack("C*", $node_data);
|
||||
print "Text '$node_data'\n"; # may contain LF chars
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Node $node_type\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// dumpNodeTree
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub dumpNodeTree($)
|
||||
{
|
||||
my($node) = @_;
|
||||
|
||||
my($child_node) = $node->getFirstChild();
|
||||
|
||||
unless ($child_node) { return; }
|
||||
|
||||
# recurse
|
||||
dumpNodeData($child_node);
|
||||
|
||||
# then go through child nodes
|
||||
while ($child_node)
|
||||
{
|
||||
dumpNodeTree($child_node);
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# These 3 lists are the 'master lists' to control what gets built.
|
||||
#
|
||||
# Ordering in these arrays is important; it has to reflect the order in
|
||||
# which the build occurs.
|
||||
#
|
||||
# Setting containing spaces must be quoted with double quotes.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
build_flags
|
||||
all 1
|
||||
pull 0
|
||||
dist 0
|
||||
config 0
|
||||
xpidl 0
|
||||
idl 0
|
||||
stubs 0
|
||||
runtime 0
|
||||
common 0
|
||||
imglib 0
|
||||
libimg2 0
|
||||
necko 0
|
||||
security 0
|
||||
browserutils 0
|
||||
intl 0
|
||||
nglayout 0
|
||||
accessiblity 0
|
||||
editor 0
|
||||
embedding 0
|
||||
viewer 0
|
||||
xpapp 0
|
||||
extensions 0
|
||||
plugins 0
|
||||
mailnews 0
|
||||
apprunner 0
|
||||
resources 0
|
||||
|
||||
options_flags
|
||||
pull_by_date 0
|
||||
chrome_jars 1
|
||||
chrome_files 0
|
||||
use_jars 1
|
||||
transformiix 1
|
||||
mathml 0 MOZ_MATHML
|
||||
svg 0 MOZ_SVG
|
||||
# svg requires libart, which is an lgpl library. You need to pull it
|
||||
# explicitly.
|
||||
libart_lgpl 0
|
||||
mng 1
|
||||
ldap 1 MOZ_LDAP_XPCOM
|
||||
ldap_experimental 0 MOZ_LDAP_XPCOM_EXPERIMENTAL
|
||||
xmlextras 1
|
||||
wsp 0 MOZ_WSP
|
||||
inspector 1
|
||||
mailextras 1
|
||||
xptlink 0
|
||||
psm 0 MOZ_PSM
|
||||
embedding_test 1
|
||||
embedding_chrome 0
|
||||
embedding_xulprefs 0
|
||||
embedding_xulsecurity 0
|
||||
carbon 0 TARGET_CARBON
|
||||
useimg2 1 USE_IMG2
|
||||
lowmem 0 MOZ_MAC_LOWMEM
|
||||
accessible 1 ACCESSIBILITY
|
||||
bidi 1 IBMBIDI
|
||||
p3p 0
|
||||
jsd 1
|
||||
venkman 1
|
||||
moz_logging 1 MOZ_LOGGING
|
||||
chatzilla 1
|
||||
content_packs 1
|
||||
xml_rpc 1
|
||||
cview 1
|
||||
help 1
|
||||
timeline 0 MOZ_TIMELINE
|
||||
static_build 0 MOZ_STATIC_COMPONENT_LIBS
|
||||
string_debug 0 DEBUG_STRING
|
||||
string_stats 0 DEBUG_STRING_STATS
|
||||
xpctools 0 XPC_TOOLS_SUPPORT
|
||||
smime 1
|
||||
mdn 1
|
||||
print_preview 1 NS_PRINT_PREVIEW
|
||||
moz_xul 1 MOZ_XUL
|
||||
|
||||
filepath_flags
|
||||
idepath ":CodeWarrior IDE Path.txt"
|
||||
sessionpath ":Mozilla session path.txt"
|
||||
buildlogfilepath ":Build Logs:Mozilla build log.txt" # this is a path
|
||||
scriptlogfilepath ":Build Logs:Mozilla script log.txt"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
# List of modules to check out. Format is
|
||||
# module, (tag), (date)
|
||||
# where tag and date are optional (non-trailing commas are required)
|
||||
#
|
||||
# Examples:
|
||||
# mozilla/nsprpub, NSPRPUB_CLIENT_TAG
|
||||
# mozilla/gc, , 10/25/2000 12:00:00
|
||||
#
|
||||
|
||||
mozilla/nsprpub, NETSCAPE_7_0_RTM
|
||||
mozilla/security/nss, NETSCAPE_7_0_RTM
|
||||
mozilla/security/manager, NETSCAPE_7_0_RTM
|
||||
mozilla/accessible, NETSCAPE_7_0_RTM
|
||||
mozilla/directory/c-sdk, NETSCAPE_7_0_RTM
|
||||
mozilla/lib/mac/Instrumentation, NETSCAPE_7_0_RTM
|
||||
mozilla/gfx2, NETSCAPE_7_0_RTM
|
||||
mozilla/modules/libpr0n, NETSCAPE_7_0_RTM
|
||||
SeaMonkeyAll, NETSCAPE_7_0_RTM
|
||||
|
||||
## You need this if you want to be able to use SVG
|
||||
## Note that this library is under the LGPL, not the MPL
|
||||
#mozilla/other-licenses/libart_lgpl
|
||||
@@ -1,79 +0,0 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::BuildCore;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Where have the build options gone?
|
||||
#
|
||||
# The various build flags have been centralized into one place.
|
||||
# The master list of options is in MozBuildFlags.txt. However,
|
||||
# you should never need to edit that file, or this one.
|
||||
#
|
||||
# To customize what gets built, or where to start the build,
|
||||
# edit the $prefs_file_name file in
|
||||
# System Folder:Preferences:Mozilla build prefs:
|
||||
# Documentation is provided in that file.
|
||||
#-------------------------------------------------------------
|
||||
|
||||
my($prefs_file_name) = "Mozilla pull prefs";
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
# Hash of input files for this build. Eventually, there will be
|
||||
# input files for manifests, and projects too.
|
||||
my(%inputfiles) = (
|
||||
"buildflags", "MozillaBuildFlags.txt",
|
||||
"checkoutdata", "MozillaCheckoutList.txt",
|
||||
"buildprogress", "",
|
||||
"buildmodule", "MozillaBuildList.pm",
|
||||
"checkouttime", "Mozilla last checkout"
|
||||
);
|
||||
#-------------------------------------------------------------
|
||||
# end build hashes
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# set the build root directory, which is the the dir above mozilla
|
||||
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
|
||||
|
||||
# Set up all the flags on $main::, like DEBUG, CARBON etc.
|
||||
# Override the defaults using the preferences files.
|
||||
SetupDefaultBuildOptions(0, ":mozilla:dist:viewer:", "");
|
||||
|
||||
my($do_checkout) = 1;
|
||||
my($do_build) = 0;
|
||||
|
||||
RunBuild($do_checkout, $do_build, \%inputfiles, $prefs_file_name);
|
||||
@@ -1,511 +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=.
|
||||
|
||||
!if !defined(MOZ_TOP)
|
||||
#enable builds from changed top level directories
|
||||
MOZ_TOP=mozilla
|
||||
!endif
|
||||
|
||||
MOZ_SRC_FLIPPED = $(MOZ_SRC:\=/)
|
||||
MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist
|
||||
!ifdef MOZ_DEBUG
|
||||
MOZ_OBJDIR = WIN32_D.OBJ
|
||||
!else
|
||||
MOZ_OBJDIR = WIN32_O.OBJ
|
||||
!endif
|
||||
|
||||
#
|
||||
# Command macro defines
|
||||
#
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to do the pull.
|
||||
#//------------------------------------------------------------------------
|
||||
# uncomment these, modify branch tag, and check in to branch for milestones
|
||||
MOZ_BRANCH=NETSCAPE_7_0_RTM
|
||||
NSPR_CO_TAG=NETSCAPE_7_0_RTM
|
||||
PSM_CO_TAG=NETSCAPE_7_0_RTM
|
||||
NSS_CO_TAG=NETSCAPE_7_0_RTM
|
||||
LDAPCSDK_CO_TAG=NETSCAPE_7_0_RTM
|
||||
ACCESSIBLE_CO_TAG=NETSCAPE_7_0_RTM
|
||||
IMGLIB2_CO_TAG=NETSCAPE_7_0_RTM
|
||||
GFX2_CO_TAG=NETSCAPE_7_0_RTM
|
||||
|
||||
|
||||
!ifdef MOZ_BRANCH
|
||||
CVS_BRANCH=-r $(MOZ_BRANCH)
|
||||
!endif
|
||||
|
||||
!ifdef MOZ_DATE
|
||||
CVS_BRANCH=$(CVS_BRANCH) -D "$(MOZ_DATE)"
|
||||
!endif
|
||||
|
||||
# default pull is "quiet" but it can be overridden with MOZ_CVS_VERBOSE
|
||||
!ifndef MOZ_CVS_VERBOSE
|
||||
CVS_FLAGS=-q
|
||||
!endif
|
||||
|
||||
# honor any user-defined CVS flags
|
||||
!ifdef MOZ_CVS_FLAGS
|
||||
CVS_FLAGS=$(CVS_FLAGS) $(MOZ_CVS_FLAGS)
|
||||
!endif
|
||||
|
||||
# let's be explicit about CVSROOT... some windows cvs clients
|
||||
# are too stupid to correctly work without the -d option
|
||||
#
|
||||
# if they are too stupid, they should fail. I am
|
||||
# commenting this out because this does not work
|
||||
# under 4nt. (%'s are evaluted differently)
|
||||
#
|
||||
# If it breaks you, mail dougt@netscape.com
|
||||
# and leaf@mozilla.org
|
||||
#
|
||||
!if 0
|
||||
!if defined(CVSROOT)
|
||||
CVS_FLAGS=$(CVS_FLAGS) -d "$(CVSROOT)"
|
||||
!endif
|
||||
!endif
|
||||
|
||||
!ifndef MOZ_CO_FLAGS
|
||||
MOZ_CO_FLAGS = -P
|
||||
!endif
|
||||
|
||||
CVSCO = cvs $(CVS_FLAGS) co $(MOZ_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull NSPR.
|
||||
#// If no NSPR_CO_TAG is specified, use the default static tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef NSPR_CO_FLAGS
|
||||
NSPR_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
NSPR_CO_FLAGS=$(NSPR_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
|
||||
CVSCO_NSPR = cvs $(CVS_FLAGS) co $(NSPR_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull NSS and PSM libs.
|
||||
#// If no NSS_CO_TAG or PSM_CO_TAG is specified, use the default static tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef NSS_CO_FLAGS
|
||||
NSS_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
NSS_CO_FLAGS=$(NSS_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_NSS = cvs $(CVS_FLAGS) co $(NSS_CO_FLAGS)
|
||||
|
||||
!ifndef PSM_CO_FLAGS
|
||||
PSM_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
PSM_CO_FLAGS=$(PSM_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_PSM = cvs $(CVS_FLAGS) co $(PSM_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull LDAP C SDK client libs.
|
||||
#// If no LDAPCSDK_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
|
||||
!ifndef LDAPCSDK_CO_FLAGS
|
||||
LDAPCSDK_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
LDAPCSDK_CO_FLAGS=$(LDAPCSDK_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_LDAPCSDK = cvs $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull accessibility libs.
|
||||
#// If no ACCESSIBLE_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef ACCESSIBLE_CO_FLAGS
|
||||
ACCESSIBLE_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
ACCESSIBLE_CO_FLAGS=$(ACCESSIBLE_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_ACCESSIBLE = cvs $(CVS_FLAGS) co $(ACCESSIBLE_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull new image library.
|
||||
#// If no IMGLIB2_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef IMGLIB2_CO_FLAGS
|
||||
IMGLIB2_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
IMGLIB2_CO_FLAGS=$(IMGLIB2_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_IMGLIB2 = cvs $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull new image library.
|
||||
#// If no GFX2_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef GFX2_CO_FLAGS
|
||||
GFX2_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
GFX2_CO_FLAGS=$(GFX2_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_GFX2 = cvs $(CVS_FLAGS) co $(GFX2_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull the internal libart
|
||||
#// (only pulled and built if MOZ_INTERNAL_LIBART_LGPL is set)
|
||||
#// If no MOZ_INTERNAL_LIBART_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!if defined(MOZ_SVG) && !defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
ERR_MESSAGE = ^
|
||||
You are trying to build Mozilla with SVG support (MOZ_SVG=1), but you ^
|
||||
haven not specified that mozilla/other-licenses/libart_lgpl should be ^
|
||||
pulled and built. At the moment Mozilla SVG builds need this patched ^
|
||||
version of libart. You either need to disable SVG support (unset MOZ_SVG) ^
|
||||
or enable pulling and building by setting MOZ_INTERNAL_LIBART_LGPL=1.^
|
||||
^
|
||||
If you choose to pull and build libart, note that it is only licensed^
|
||||
under the terms of the LGPL, not the MPL. (Which is why you have to opt^
|
||||
in explicitly.)
|
||||
!endif
|
||||
|
||||
!if defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
|
||||
!ifndef MOZ_INTERNAL_LIBART_CO_FLAGS
|
||||
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
!if "$(MOZ_INTERNAL_LIBART_CO_TAG)" != ""
|
||||
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) -r $(MOZ_INTERNAL_LIBART_CO_TAG)
|
||||
!else
|
||||
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) $(CVS_BRANCH)
|
||||
!endif
|
||||
|
||||
CVSCO_MOZ_INTERNAL_LIBART = cvs $(CVS_FLAGS) co $(MOZ_INTERNAL_LIBART_CO_FLAGS)
|
||||
|
||||
!endif
|
||||
|
||||
## The master target
|
||||
############################################################
|
||||
|
||||
pull_and_build_all: pull_all build_all_dep
|
||||
|
||||
|
||||
## Rules for pulling the source from the cvs repository
|
||||
############################################################
|
||||
|
||||
pull_clobber_and_build_all: pull_all clobber_all build_all
|
||||
|
||||
!if !defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_seamonkey
|
||||
!else
|
||||
pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_moz_internal_libart pull_seamonkey
|
||||
!endif
|
||||
|
||||
pull_nspr: pull_clientmak
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_NSPR) mozilla/nsprpub
|
||||
|
||||
pull_nss:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_NSS) mozilla/security/coreconf
|
||||
$(CVSCO_NSS) mozilla/security/nss
|
||||
|
||||
pull_psm: pull_nss
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_PSM) mozilla/security/manager
|
||||
$(CVSCO_PSM) mozilla/security/makefile.win
|
||||
|
||||
pull_ldapcsdk:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_LDAPCSDK) mozilla/directory/c-sdk
|
||||
|
||||
pull_accessible:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_ACCESSIBLE) mozilla/accessible
|
||||
|
||||
pull_gfx2:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_GFX2) mozilla/gfx2
|
||||
|
||||
pull_imglib2:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_IMGLIB2) mozilla/modules/libpr0n
|
||||
|
||||
!if defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
pull_moz_internal_libart:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_MOZ_INTERNAL_LIBART) mozilla/other-licenses/libart_lgpl
|
||||
!endif
|
||||
|
||||
pull_xpconnect: pull_nspr
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) mozilla/include
|
||||
$(CVSCO) mozilla/config
|
||||
$(CVSCO) -l mozilla/js
|
||||
$(CVSCO) -l mozilla/js/src
|
||||
$(CVSCO) mozilla/js/src/fdlibm
|
||||
$(CVSCO) mozilla/js/src/xpconnect
|
||||
$(CVSCO) mozilla/modules/libreg
|
||||
$(CVSCO) mozilla/xpcom
|
||||
$(CVSCO) mozilla/string
|
||||
|
||||
# pull either layout only or seamonkey the browser
|
||||
pull_layout:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) RaptorWin
|
||||
|
||||
pull_seamonkey: pull_clientmak
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) SeaMonkeyAll
|
||||
|
||||
pull_clientmak:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) mozilla/client.mak
|
||||
|
||||
############################################################
|
||||
|
||||
# nmake has to be hardcoded, or we have to depend on mozilla/config
|
||||
# being pulled already to figure out what $(NMAKE) should be.
|
||||
|
||||
clobber_all: clobber_nspr clobber_ldapcsdk clobber_psm clobber_seamonkey
|
||||
|
||||
build_all: build_nspr build_ldapcsdk build_seamonkey
|
||||
|
||||
build_all_dep: depend libs
|
||||
|
||||
distclean:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
|
||||
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)
|
||||
nmake /f client.mak clobber_psm
|
||||
nmake /f client.mak clobber_seamonkey
|
||||
|
||||
clobber_ldapcsdk:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
|
||||
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED) \
|
||||
SHELL=sh
|
||||
|
||||
clobber_nspr:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
|
||||
clobber_psm:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_xpconnect:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
-rd /s /q dist
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_seamonkey:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
-rd /s /q dist
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
depend: export
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win depend
|
||||
|
||||
depend_xpconnect:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
|
||||
nmake -f makefile.win depend
|
||||
|
||||
build_nspr:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
|
||||
build_ldapcsdk:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
|
||||
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED) SHELL=sh
|
||||
|
||||
build_psm:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
|
||||
nmake -f makefile.win
|
||||
|
||||
build_xpconnect: build_nspr
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win export
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win libs
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_seamonkey:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_client:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_layout:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_dist:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
libs:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win libs
|
||||
|
||||
export: build_nspr build_ldapcsdk
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win export
|
||||
|
||||
clobber_dist:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_client:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_layout:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
browse_info::
|
||||
cd $(MOZ_SRC)\$(MOZ_TOP)
|
||||
-dir /s /b *.sbr > sbrlist.tmp
|
||||
-bscmake /Es /o mozilla.bsc @sbrlist.tmp
|
||||
-rm sbrlist.tmp
|
||||
|
||||
regchrome::
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake /f makefile.win regchrome
|
||||
|
||||
deliver::
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake /f makefile.win splitsymbols
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Utility stuff...
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
# Verify that MOZ_SRC is set correctly
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
# Check to see if it is set at all
|
||||
!if "$(MOZ_SRC)"==""
|
||||
MOZ_SRC = $(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
#
|
||||
# create a temp file at the root and make sure it is visible from MOZ_SRC
|
||||
#
|
||||
!if [copy $(MAKEDIR)\client.mak $(MAKEDIR)\xyzzy.tmp > NUL] == 0
|
||||
!endif
|
||||
|
||||
!if !EXIST( $(MOZ_SRC)\mozilla\xyzzy.tmp )
|
||||
ERR_MESSAGE=$(ERR_MESSAGE)^
|
||||
MOZ_SRC isn't set correctly: [$(MOZ_SRC)\mozilla]!=[$(MAKEDIR)]
|
||||
!endif
|
||||
|
||||
!if [del $(MAKEDIR)\xyzzy.tmp]
|
||||
!endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
# Verify that MOZ_BITS is set
|
||||
#//------------------------------------------------------------------------
|
||||
!if !defined(MOZ_BITS)
|
||||
ERR_MESSAGE=$(ERR_MESSAGE)^
|
||||
Environment variable MOZ_BITS isn't set.
|
||||
!endif
|
||||
|
||||
!if !defined(MOZ_TOOLS)
|
||||
ERR_MESSAGE=$(ERR_MESSAGE)^
|
||||
Environment variable MOZ_TOOLS isn't set.
|
||||
!endif
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Display error
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!if "$(ERR_MESSAGE)" != ""
|
||||
ERR_MESSAGE = ^
|
||||
client.mak: ^
|
||||
$(ERR_MESSAGE) ^
|
||||
^
|
||||
client.mak: usage^
|
||||
^
|
||||
nmake -f client.mak [MOZ_BRANCH=<cvs_branch_name>] ^
|
||||
[MOZ_DATE=<cvs_date>]^
|
||||
[pull_and_build_all]^
|
||||
[pull_all]^
|
||||
[build_all]^
|
||||
^
|
||||
Environment variables:^
|
||||
^
|
||||
MOZ_BITS set to 32^
|
||||
MOZ_TOOLS set to the directory containing the needed tools ^
|
||||
|
||||
!ERROR $(ERR_MESSAGE)
|
||||
|
||||
!endif
|
||||
@@ -1,650 +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): Stephen Lamm
|
||||
|
||||
# Build the Mozilla client.
|
||||
#
|
||||
# This needs CVSROOT set to work, e.g.,
|
||||
# setenv CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
||||
# or
|
||||
# setenv CVSROOT :pserver:username%somedomain.org@cvs.mozilla.org:/cvsroot
|
||||
#
|
||||
# To checkout and build a tree,
|
||||
# 1. cvs co mozilla/client.mk
|
||||
# 2. cd mozilla
|
||||
# 3. gmake -f client.mk
|
||||
#
|
||||
# Other targets (gmake -f client.mk [targets...]),
|
||||
# checkout
|
||||
# build
|
||||
# clean (realclean is now the same as clean)
|
||||
# distclean
|
||||
#
|
||||
# See http://www.mozilla.org/build/unix.html for more information.
|
||||
#
|
||||
# Options:
|
||||
# MOZ_OBJDIR - Destination object directory
|
||||
# MOZ_CO_DATE - Date tag to use for checkout (default: none)
|
||||
# MOZ_CO_MODULE - Module to checkout (default: SeaMonkeyAll)
|
||||
# MOZ_CVS_FLAGS - Flags to pass cvs (default: -q -z3)
|
||||
# MOZ_CO_FLAGS - Flags to pass after 'cvs co' (default: -P)
|
||||
# MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
|
||||
# MOZ_CO_BRANCH - Branch tag (Deprecated. Use MOZ_CO_TAG below.)
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# Checkout Tags
|
||||
#
|
||||
# For branches, uncomment the MOZ_CO_TAG line with the proper tag,
|
||||
# and commit this file on that tag.
|
||||
MOZ_CO_TAG = NETSCAPE_7_0_RTM
|
||||
NSPR_CO_TAG = NETSCAPE_7_0_RTM
|
||||
PSM_CO_TAG = NETSCAPE_7_0_RTM
|
||||
NSS_CO_TAG = NETSCAPE_7_0_RTM
|
||||
LDAPCSDK_CO_TAG = NETSCAPE_7_0_RTM
|
||||
ACCESSIBLE_CO_TAG = NETSCAPE_7_0_RTM
|
||||
GFX2_CO_TAG = NETSCAPE_7_0_RTM
|
||||
IMGLIB2_CO_TAG = NETSCAPE_7_0_RTM
|
||||
BUILD_MODULES = all
|
||||
|
||||
#######################################################################
|
||||
# Defines
|
||||
#
|
||||
CVS = cvs
|
||||
|
||||
CWD := $(shell pwd)
|
||||
|
||||
ifeq "$(CWD)" "/"
|
||||
CWD := /.
|
||||
endif
|
||||
|
||||
ifneq (, $(wildcard client.mk))
|
||||
# Ran from mozilla directory
|
||||
ROOTDIR := $(shell dirname $(CWD))
|
||||
TOPSRCDIR := $(CWD)
|
||||
else
|
||||
# Ran from mozilla/.. directory (?)
|
||||
ROOTDIR := $(CWD)
|
||||
TOPSRCDIR := $(CWD)/mozilla
|
||||
endif
|
||||
|
||||
# on os2, TOPSRCDIR may have two forward slashes in a row, which doesn't
|
||||
# work; replace first instance with one forward slash
|
||||
TOPSRCDIR := $(shell echo "$(TOPSRCDIR)" | sed -e 's%//%/%')
|
||||
|
||||
ifndef TOPSRCDIR_MOZ
|
||||
TOPSRCDIR_MOZ=$(TOPSRCDIR)
|
||||
endif
|
||||
|
||||
# if ROOTDIR equals only drive letter (i.e. "C:"), set to "/"
|
||||
DIRNAME := $(shell echo "$(ROOTDIR)" | sed -e 's/^.://')
|
||||
ifeq ($(DIRNAME),)
|
||||
ROOTDIR := /.
|
||||
endif
|
||||
|
||||
AUTOCONF := autoconf
|
||||
MKDIR := mkdir
|
||||
SH := /bin/sh
|
||||
ifndef MAKE
|
||||
MAKE := gmake
|
||||
endif
|
||||
|
||||
CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
|
||||
ifdef CONFIG_GUESS_SCRIPT
|
||||
CONFIG_GUESS = $(shell $(CONFIG_GUESS_SCRIPT))
|
||||
else
|
||||
_IS_FIRST_CHECKOUT := 1
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS
|
||||
|
||||
# Add the CVS root to CVS_FLAGS if needed
|
||||
CVS_ROOT_IN_TREE := $(shell cat $(TOPSRCDIR)/CVS/Root 2>/dev/null)
|
||||
ifneq ($(CVS_ROOT_IN_TREE),)
|
||||
ifneq ($(CVS_ROOT_IN_TREE),$(CVSROOT))
|
||||
CVS_FLAGS := -d $(CVS_ROOT_IN_TREE)
|
||||
endif
|
||||
endif
|
||||
|
||||
CVSCO = $(strip $(CVS) $(CVS_FLAGS) co $(CVS_CO_FLAGS))
|
||||
CVSCO_LOGFILE := $(ROOTDIR)/cvsco.log
|
||||
CVSCO_LOGFILE := $(shell echo $(CVSCO_LOGFILE) | sed s%//%/%)
|
||||
|
||||
ifdef MOZ_CO_TAG
|
||||
CVS_CO_FLAGS := -r $(MOZ_CO_TAG)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# Load mozconfig Options
|
||||
|
||||
# See build pages, http://www.mozilla.org/build/unix.html,
|
||||
# for how to set up mozconfig.
|
||||
MOZCONFIG_LOADER := mozilla/build/autoconf/mozconfig2client-mk
|
||||
MOZCONFIG_FINDER := mozilla/build/autoconf/mozconfig-find
|
||||
MOZCONFIG_MODULES := mozilla/build/unix/modules.mk
|
||||
run_for_side_effects := \
|
||||
$(shell cd $(ROOTDIR); \
|
||||
if test "$(_IS_FIRST_CHECKOUT)"; then \
|
||||
$(CVSCO) $(MOZCONFIG_FINDER) $(MOZCONFIG_LOADER) $(MOZCONFIG_MODULES); \
|
||||
else true; \
|
||||
fi; \
|
||||
$(MOZCONFIG_LOADER) $(TOPSRCDIR) mozilla/.mozconfig.mk > mozilla/.mozconfig.out)
|
||||
include $(TOPSRCDIR)/.mozconfig.mk
|
||||
include $(TOPSRCDIR)/build/unix/modules.mk
|
||||
|
||||
####################################
|
||||
# Options that may come from mozconfig
|
||||
|
||||
# Change CVS flags if anonymous root is requested
|
||||
ifdef MOZ_CO_USE_MIRROR
|
||||
CVS_FLAGS := -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
||||
endif
|
||||
|
||||
# MOZ_CVS_FLAGS - Basic CVS flags
|
||||
ifeq "$(origin MOZ_CVS_FLAGS)" "undefined"
|
||||
CVS_FLAGS := $(CVS_FLAGS) -q -z 3
|
||||
else
|
||||
CVS_FLAGS := $(MOZ_CVS_FLAGS)
|
||||
endif
|
||||
|
||||
# This option is deprecated. The best way to have client.mk pull a tag
|
||||
# is to set MOZ_CO_TAG (see above) and commit that change on the tag.
|
||||
ifdef MOZ_CO_BRANCH
|
||||
$(warning Use MOZ_CO_TAG instead of MOZ_CO_BRANCH)
|
||||
CVS_CO_FLAGS := -r $(MOZ_CO_BRANCH)
|
||||
endif
|
||||
|
||||
# MOZ_CO_FLAGS - Anything that we should use on all checkouts
|
||||
ifeq "$(origin MOZ_CO_FLAGS)" "undefined"
|
||||
CVS_CO_FLAGS := $(CVS_CO_FLAGS) -P
|
||||
else
|
||||
CVS_CO_FLAGS := $(CVS_CO_FLAGS) $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
|
||||
ifdef MOZ_CO_DATE
|
||||
CVS_CO_DATE_FLAGS := -D "$(MOZ_CO_DATE)"
|
||||
endif
|
||||
|
||||
ifdef MOZ_OBJDIR
|
||||
OBJDIR := $(MOZ_OBJDIR)
|
||||
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
|
||||
else
|
||||
OBJDIR := $(TOPSRCDIR)
|
||||
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for PSM
|
||||
#
|
||||
PSM_CO_MODULE= mozilla/security/manager
|
||||
PSM_CO_FLAGS := -P -A
|
||||
ifdef MOZ_CO_FLAGS
|
||||
PSM_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef PSM_CO_TAG
|
||||
PSM_CO_FLAGS := $(PSM_CO_FLAGS) -r $(PSM_CO_TAG)
|
||||
endif
|
||||
CVSCO_PSM = $(CVS) $(CVS_FLAGS) co $(PSM_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(PSM_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for NSS
|
||||
#
|
||||
NSS_CO_MODULE = mozilla/security/nss \
|
||||
mozilla/security/coreconf \
|
||||
$(NULL)
|
||||
|
||||
NSS_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
NSS_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef NSS_CO_TAG
|
||||
NSS_CO_FLAGS := $(NSS_CO_FLAGS) -r $(NSS_CO_TAG)
|
||||
endif
|
||||
# Cannot pull static tags by date
|
||||
ifeq ($(NSS_CO_TAG),NSS_CLIENT_TAG)
|
||||
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(NSS_CO_MODULE)
|
||||
else
|
||||
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSS_CO_MODULE)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for NSPR
|
||||
#
|
||||
NSPR_CO_MODULE = mozilla/nsprpub
|
||||
NSPR_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
NSPR_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef NSPR_CO_TAG
|
||||
NSPR_CO_FLAGS := $(NSPR_CO_FLAGS) -r $(NSPR_CO_TAG)
|
||||
endif
|
||||
# Cannot pull static tags by date
|
||||
ifeq ($(NSPR_CO_TAG),NSPRPUB_CLIENT_TAG)
|
||||
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(NSPR_CO_MODULE)
|
||||
else
|
||||
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSPR_CO_MODULE)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for the C LDAP SDK
|
||||
#
|
||||
LDAPCSDK_CO_MODULE = mozilla/directory/c-sdk
|
||||
LDAPCSDK_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
LDAPCSDK_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef LDAPCSDK_CO_TAG
|
||||
LDAPCSDK_CO_FLAGS := $(LDAPCSDK_CO_FLAGS) -r $(LDAPCSDK_CO_TAG)
|
||||
endif
|
||||
CVSCO_LDAPCSDK = $(CVS) $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(LDAPCSDK_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for the C LDAP SDK
|
||||
#
|
||||
ACCESSIBLE_CO_MODULE = mozilla/accessible
|
||||
ACCESSIBLE_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
ACCESSIBLE_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef ACCESSIBLE_CO_TAG
|
||||
ACCESSIBLE_CO_FLAGS := $(ACCESSIBLE_CO_FLAGS) -r $(ACCESSIBLE_CO_TAG)
|
||||
endif
|
||||
CVSCO_ACCESSIBLE = $(CVS) $(CVS_FLAGS) co $(ACCESSIBLE_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(ACCESSIBLE_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for gfx2
|
||||
#
|
||||
GFX2_CO_MODULE = mozilla/gfx2
|
||||
GFX2_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
GFX2_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef GFX2_CO_TAG
|
||||
GFX2_CO_FLAGS := $(GFX2_CO_FLAGS) -r $(GFX2_CO_TAG)
|
||||
endif
|
||||
CVSCO_GFX2 = $(CVS) $(CVS_FLAGS) co $(GFX2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(GFX2_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for new image library
|
||||
#
|
||||
IMGLIB2_CO_MODULE = mozilla/modules/libpr0n
|
||||
IMGLIB2_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
IMGLIB2_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef IMGLIB2_CO_TAG
|
||||
IMGLIB2_CO_FLAGS := $(IMGLIB2_CO_FLAGS) -r $(IMGLIB2_CO_TAG)
|
||||
endif
|
||||
CVSCO_IMGLIB2 = $(CVS) $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(IMGLIB2_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for standalone modules
|
||||
#
|
||||
ifneq ($(BUILD_MODULES),all)
|
||||
MOZ_CO_MODULE := $(filter-out $(NSPRPUB_DIR) security directory/c-sdk, $(BUILD_MODULE_CVS))
|
||||
MOZ_CO_MODULE += allmakefiles.sh client.mk aclocal.m4 configure configure.in
|
||||
MOZ_CO_MODULE += Makefile.in
|
||||
MOZ_CO_MODULE := $(addprefix mozilla/, $(MOZ_CO_MODULE))
|
||||
|
||||
NOSUBDIRS_MODULE := $(addprefix mozilla/, $(BUILD_MODULE_CVS_NS))
|
||||
ifneq ($(NOSUBDIRS_MODULE),)
|
||||
CVSCO_NOSUBDIRS := $(CVSCO) -l $(CVS_CO_DATE_FLAGS) $(NOSUBDIRS_MODULE)
|
||||
endif
|
||||
|
||||
ifeq (,$(filter $(NSPRPUB_DIR), $(BUILD_MODULE_CVS)))
|
||||
CVSCO_NSPR :=
|
||||
endif
|
||||
ifeq (,$(filter security security/manager, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_PSM :=
|
||||
CVSCO_NSS :=
|
||||
endif
|
||||
ifeq (,$(filter directory/c-sdk, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_LDAPCSDK :=
|
||||
endif
|
||||
ifeq (,$(filter accessible, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_ACCESSIBLE :=
|
||||
endif
|
||||
ifeq (,$(filter gfx2, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_GFX2 :=
|
||||
endif
|
||||
ifeq (,$(filter modules/libpr0n, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_IMGLIB2 :=
|
||||
endif
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for SeaMonkey
|
||||
#
|
||||
ifeq ($(MOZ_CO_MODULE),)
|
||||
MOZ_CO_MODULE := SeaMonkeyAll
|
||||
endif
|
||||
CVSCO_SEAMONKEY := $(CVSCO) $(CVS_CO_DATE_FLAGS) $(MOZ_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defined for libart (pulled and built if MOZ_INTERNAL_LIBART_LGPL is set)
|
||||
#
|
||||
CVSCO_LIBART := $(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/other-licenses/libart_lgpl
|
||||
|
||||
ifdef MOZ_INTERNAL_LIBART_LGPL
|
||||
FASTUPDATE_LIBART := fast_update $(CVSCO_LIBART)
|
||||
CHECKOUT_LIBART := cvs_co $(CVSCO_LIBART)
|
||||
else
|
||||
CHECKOUT_LIBART := true
|
||||
FASTUPDATE_LIBART := true
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for Calendar (pulled and built if MOZ_CALENDAR is set)
|
||||
#
|
||||
CVSCO_CALENDAR := $(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/calendar
|
||||
|
||||
ifdef MOZ_CALENDAR
|
||||
FASTUPDATE_CALENDAR := fast_update $(CVSCO_CALENDAR)
|
||||
CHECKOUT_CALENDAR := cvs_co $(CVSCO_CALENDAR)
|
||||
else
|
||||
CHECKOUT_CALENDAR := true
|
||||
FASTUPDATE_CALENDAR := true
|
||||
endif
|
||||
|
||||
|
||||
# because some cygwin tools can't handle native dos-drive paths & vice-versa
|
||||
# force configure to use a relative path for --srcdir
|
||||
# need a better check for win32
|
||||
# and we need to get OBJDIR earlier
|
||||
ifdef MOZ_TOOLS
|
||||
_tmpobjdir := $(shell cygpath -u $(OBJDIR))
|
||||
_abs2rel := $(shell cygpath -w $(TOPSRCDIR)/build/unix/abs2rel.pl | sed -e 's|\\|/|g')
|
||||
_OBJ2SRCPATH := $(shell $(_abs2rel) $(TOPSRCDIR) $(_tmpobjdir))
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
# Rules
|
||||
#
|
||||
|
||||
# Print out any options loaded from mozconfig.
|
||||
all build checkout clean depend distclean export libs install realclean::
|
||||
@if test -f .mozconfig.out; then \
|
||||
cat .mozconfig.out; \
|
||||
rm -f .mozconfig.out; \
|
||||
else true; \
|
||||
fi
|
||||
|
||||
ifdef _IS_FIRST_CHECKOUT
|
||||
all:: checkout build
|
||||
else
|
||||
all:: checkout alldep
|
||||
endif
|
||||
|
||||
# Windows equivalents
|
||||
pull_all: checkout
|
||||
build_all: build
|
||||
build_all_dep: alldep
|
||||
build_all_depend: alldep
|
||||
clobber clobber_all: clean
|
||||
pull_and_build_all: checkout alldep
|
||||
|
||||
# Do everything from scratch
|
||||
everything: checkout clean build
|
||||
|
||||
####################################
|
||||
# CVS checkout
|
||||
#
|
||||
checkout::
|
||||
# @: Backup the last checkout log.
|
||||
@if test -f $(CVSCO_LOGFILE) ; then \
|
||||
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo "Removing local configures" ; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
|
||||
mozilla/directory/c-sdk/configure
|
||||
endif
|
||||
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
|
||||
@echo '$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk'; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk
|
||||
@cd $(ROOTDIR) && $(MAKE) -f mozilla/client.mk real_checkout
|
||||
|
||||
real_checkout:
|
||||
# @: Start the checkout. Split the output to the tty and a log file. \
|
||||
# : If it fails, touch an error file because "tee" hides the error.
|
||||
@failed=.cvs-failed.tmp; rm -f $$failed*; \
|
||||
cvs_co() { echo "$$@" ; \
|
||||
("$$@" || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
|
||||
if test -f $$failed; then false; else true; fi; }; \
|
||||
cvs_co $(CVSCO_NSPR) && \
|
||||
cvs_co $(CVSCO_NSS) && \
|
||||
cvs_co $(CVSCO_PSM) && \
|
||||
cvs_co $(CVSCO_LDAPCSDK) && \
|
||||
cvs_co $(CVSCO_ACCESSIBLE) && \
|
||||
cvs_co $(CVSCO_GFX2) && \
|
||||
cvs_co $(CVSCO_IMGLIB2) && \
|
||||
$(CHECKOUT_CALENDAR) && \
|
||||
$(CHECKOUT_LIBART) && \
|
||||
cvs_co $(CVSCO_SEAMONKEY) && \
|
||||
cvs_co $(CVSCO_NOSUBDIRS)
|
||||
@echo "checkout finish: "`date` | tee -a $(CVSCO_LOGFILE)
|
||||
# @: Check the log for conflicts. ;
|
||||
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
|
||||
if test "$$conflicts" ; then \
|
||||
echo "$(MAKE): *** Conflicts during checkout." ;\
|
||||
echo "$$conflicts" ;\
|
||||
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
|
||||
false; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo Generating configures using $(AUTOCONF) ; \
|
||||
cd $(TOPSRCDIR) && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/directory/c-sdk && $(AUTOCONF)
|
||||
endif
|
||||
|
||||
fast-update:
|
||||
# @: Backup the last checkout log.
|
||||
@if test -f $(CVSCO_LOGFILE) ; then \
|
||||
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo "Removing local configures" ; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
|
||||
mozilla/directory/c-sdk/configure
|
||||
endif
|
||||
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
|
||||
@echo '$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk'; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk
|
||||
@cd $(TOPSRCDIR) && \
|
||||
$(MAKE) -f client.mk real_fast-update
|
||||
|
||||
real_fast-update:
|
||||
# @: Start the update. Split the output to the tty and a log file. \
|
||||
# : If it fails, touch an error file because "tee" hides the error.
|
||||
@failed=.fast_update-failed.tmp; rm -f $$failed*; \
|
||||
fast_update() { (config/cvsco-fast-update.pl $$@ || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
|
||||
if test -f $$failed; then false; else true; fi; }; \
|
||||
cvs_co() { echo "$$@" ; \
|
||||
("$$@" || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
|
||||
if test -f $$failed; then false; else true; fi; }; \
|
||||
fast_update $(CVSCO_NSPR) && \
|
||||
cd $(ROOTDIR) && \
|
||||
failed=mozilla/.fast_update-failed.tmp && \
|
||||
cvs_co $(CVSCO_NSS) && \
|
||||
failed=.fast_update-failed.tmp && \
|
||||
cd mozilla && \
|
||||
fast_update $(CVSCO_PSM) && \
|
||||
fast_update $(CVSCO_LDAPCSDK) && \
|
||||
fast_update $(CVSCO_ACCESSIBLE) && \
|
||||
fast_update $(CVSCO_GFX2) && \
|
||||
fast_update $(CVSCO_IMGLIB2) && \
|
||||
$(FASTUPDATE_CALENDAR) && \
|
||||
$(FASTUPDATE_LIBART) && \
|
||||
fast_update $(CVSCO_SEAMONKEY) && \
|
||||
fast_update $(CVSCO_NOSUBDIRS)
|
||||
@echo "fast_update finish: "`date` | tee -a $(CVSCO_LOGFILE)
|
||||
# @: Check the log for conflicts. ;
|
||||
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
|
||||
if test "$$conflicts" ; then \
|
||||
echo "$(MAKE): *** Conflicts during fast-update." ;\
|
||||
echo "$$conflicts" ;\
|
||||
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
|
||||
false; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo Generating configures using $(AUTOCONF) ; \
|
||||
cd $(TOPSRCDIR) && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/directory/c-sdk && $(AUTOCONF)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# Web configure
|
||||
|
||||
WEBCONFIG_FILE := $(HOME)/.mozconfig
|
||||
|
||||
MOZCONFIG2CONFIGURATOR := build/autoconf/mozconfig2configurator
|
||||
webconfig:
|
||||
@cd $(TOPSRCDIR); \
|
||||
url=`$(MOZCONFIG2CONFIGURATOR) $(TOPSRCDIR)`; \
|
||||
echo Running mozilla with the following url: ;\
|
||||
echo ;\
|
||||
echo $$url ;\
|
||||
mozilla -remote "openURL($$url)" || \
|
||||
netscape -remote "openURL($$url)" || \
|
||||
mozilla $$url || \
|
||||
netscape $$url ;\
|
||||
echo ;\
|
||||
echo 1. Fill out the form on the browser. ;\
|
||||
echo 2. Save the results to $(WEBCONFIG_FILE)
|
||||
|
||||
#####################################################
|
||||
# First Checkout
|
||||
|
||||
ifdef _IS_FIRST_CHECKOUT
|
||||
# First time, do build target in a new process to pick up new files.
|
||||
build::
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk build
|
||||
else
|
||||
|
||||
#####################################################
|
||||
# After First Checkout
|
||||
|
||||
|
||||
####################################
|
||||
# Configure
|
||||
|
||||
CONFIG_STATUS := $(wildcard $(OBJDIR)/config.status)
|
||||
CONFIG_CACHE := $(wildcard $(OBJDIR)/config.cache)
|
||||
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
EXTRA_CONFIG_DEPS := \
|
||||
$(TOPSRCDIR)/aclocal.m4 \
|
||||
$(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
|
||||
$(NULL)
|
||||
|
||||
$(TOPSRCDIR)/configure: $(TOPSRCDIR)/configure.in $(EXTRA_CONFIG_DEPS)
|
||||
@echo Generating $@ using autoconf
|
||||
cd $(TOPSRCDIR); $(AUTOCONF)
|
||||
endif
|
||||
|
||||
CONFIG_STATUS_DEPS_L10N := $(wildcard $(TOPSRCDIR)/l10n/makefiles.all)
|
||||
|
||||
CONFIG_STATUS_DEPS := \
|
||||
$(TOPSRCDIR)/configure \
|
||||
$(TOPSRCDIR)/allmakefiles.sh \
|
||||
$(TOPSRCDIR)/.mozconfig.mk \
|
||||
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
|
||||
$(wildcard $(TOPSRCDIR)/directory/c-sdk/configure) \
|
||||
$(wildcard $(TOPSRCDIR)/mailnews/makefiles) \
|
||||
$(CONFIG_STATUS_DEPS_L10N) \
|
||||
$(wildcard $(TOPSRCDIR)/themes/makefiles) \
|
||||
$(NULL)
|
||||
|
||||
# configure uses the program name to determine @srcdir@. Calling it without
|
||||
# $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
|
||||
# path of $(TOPSRCDIR).
|
||||
ifeq ($(TOPSRCDIR),$(OBJDIR))
|
||||
CONFIGURE := ./configure
|
||||
else
|
||||
CONFIGURE := $(TOPSRCDIR)/configure
|
||||
endif
|
||||
|
||||
ifdef _OBJ2SRCPATH
|
||||
CONFIGURE_ARGS := --srcdir=$(_OBJ2SRCPATH) $(CONFIGURE_ARGS)
|
||||
endif
|
||||
|
||||
$(OBJDIR)/Makefile $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
|
||||
@if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
|
||||
@echo cd $(OBJDIR);
|
||||
@echo $(CONFIGURE) $(CONFIGURE_ARGS)
|
||||
@cd $(OBJDIR) && $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
|
||||
|| ( echo "*** Fix above errors and then restart with\
|
||||
\"$(MAKE) -f client.mk build\"" && exit 1 )
|
||||
@touch $(OBJDIR)/Makefile
|
||||
|
||||
ifdef CONFIG_STATUS
|
||||
$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
|
||||
cd $(OBJDIR); \
|
||||
CONFIG_FILES=config/autoconf.mk ./config.status
|
||||
endif
|
||||
|
||||
|
||||
####################################
|
||||
# Depend
|
||||
|
||||
depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) export && $(MOZ_MAKE) depend
|
||||
|
||||
####################################
|
||||
# Build it
|
||||
|
||||
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE)
|
||||
|
||||
####################################
|
||||
# Other targets
|
||||
|
||||
# Pass these target onto the real build system
|
||||
install export libs clean realclean distclean alldep:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) $@
|
||||
|
||||
cleansrcdir:
|
||||
@cd $(TOPSRCDIR); \
|
||||
if [ -f webshell/embed/gtk/Makefile ]; then \
|
||||
$(MAKE) -C webshell/embed/gtk distclean; \
|
||||
fi; \
|
||||
if [ -f Makefile ]; then \
|
||||
$(MAKE) distclean ; \
|
||||
else \
|
||||
echo "Removing object files from srcdir..."; \
|
||||
rm -fr `find . -type d \( -name .deps -print -o -name CVS \
|
||||
-o -exec test ! -d {}/CVS \; \) -prune \
|
||||
-o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
|
||||
build/autoconf/clean-config.sh; \
|
||||
fi;
|
||||
|
||||
# (! IS_FIRST_CHECKOUT)
|
||||
endif
|
||||
|
||||
.PHONY: checkout real_checkout depend build export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything
|
||||
2651
mozilla/cmd/winfe/feutil.cpp
Executable file
2651
mozilla/cmd/winfe/feutil.cpp
Executable file
File diff suppressed because it is too large
Load Diff
3418
mozilla/cmd/winfe/genframe.cpp
Normal file
3418
mozilla/cmd/winfe/genframe.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2442
mozilla/cmd/winfe/mozilla.cpp
Normal file
2442
mozilla/cmd/winfe/mozilla.cpp
Normal file
File diff suppressed because it is too large
Load Diff
898
mozilla/cmd/winfe/npwplat.cpp
Normal file
898
mozilla/cmd/winfe/npwplat.cpp
Normal file
@@ -0,0 +1,898 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
// npwplat.cpp
|
||||
#include "stdafx.h"
|
||||
#include <afxole.h>
|
||||
#include <afxpriv.h>
|
||||
#include <afxwin.h>
|
||||
#include <errno.h>
|
||||
#include <direct.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <winver.h>
|
||||
#else
|
||||
#include <dos.h>
|
||||
#include <ver.h>
|
||||
#endif
|
||||
#include "npwplat.h"
|
||||
#include "nppg.h"
|
||||
#include "plgindll.h"
|
||||
#include "np.h"
|
||||
#include "helper.h"
|
||||
#if defined(OJI)
|
||||
#include "jvmmgr.h"
|
||||
#elif defined(JAVA)
|
||||
#include "java.h"
|
||||
#endif
|
||||
#include "edt.h"
|
||||
#include "npglue.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
NPPMgtBlk* g_pRegisteredPluginList = NULL;
|
||||
|
||||
// Tests that the directory specified by "dir" exists.
|
||||
// Returns true if it does.
|
||||
|
||||
static XP_Bool wfe_CheckDir(const char * dir)
|
||||
{
|
||||
int ret;
|
||||
XP_StatStruct statinfo;
|
||||
|
||||
ret = _stat((char *) dir, &statinfo);
|
||||
if(ret == -1)
|
||||
return(FALSE);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
}
|
||||
|
||||
// Get the name of the directory where plugins live. "csDirname" is where the
|
||||
// name of the dir is written to, and the trailing slash is removed.
|
||||
// It always returns NPERR_NO_ERROR, since the Nav had to be started to get
|
||||
// here, and the plugin dir is under where Nav started from.
|
||||
NPError wfe_GetPluginsDirectory(CString& csDirname)
|
||||
{
|
||||
char ca_default[_MAX_PATH];
|
||||
::GetModuleFileName(AfxGetApp()->m_hInstance, ca_default, _MAX_PATH);
|
||||
char *cp_lastslash = ::strrchr(ca_default, '\\');
|
||||
*cp_lastslash = NULL;
|
||||
csDirname = ca_default;
|
||||
csDirname += "\\plugins";
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NPError wfe_GetJavaDirectory(CString& csDirname)
|
||||
{
|
||||
char ca_default[_MAX_PATH];
|
||||
::GetModuleFileName(AfxGetApp()->m_hInstance, ca_default, _MAX_PATH);
|
||||
char *cp_lastslash = ::strrchr(ca_default, '\\');
|
||||
*cp_lastslash = NULL;
|
||||
csDirname = ca_default;
|
||||
csDirname += "\\java\\classes";
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Fetches the "MIME type" string from the DLL VERSIONINFO structure.
|
||||
// "pVersionInfo" is ptr to the VERSIONINFO data, and "pNPMgtBlk" is a handle
|
||||
// to a plugin management data structure created during fe_RegisterPlugin().
|
||||
// The string is copied from the VERSIONINFO data into the
|
||||
// "pNPMgtBlk->szMIMEType" member.
|
||||
// An error is returned if out of memory. The MIME type string IS
|
||||
// required, so an error is returned if the string does not exist.
|
||||
NPError wfe_GetPluginMIMEType(VS_FIXEDFILEINFO* pVersionInfo,
|
||||
NPPMgtBlk* pNPMgtBlk)
|
||||
{
|
||||
// get the mime type of this plugin
|
||||
static char szMimeTypeBlock[] = "StringFileInfo\\040904E4\\MIMEType";
|
||||
void* lpBuffer = NULL;
|
||||
UINT uValueSize = 0;
|
||||
if(::VerQueryValue(pVersionInfo, szMimeTypeBlock,
|
||||
&lpBuffer, &uValueSize) == 0) // couldn't find MIME type
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
pNPMgtBlk->szMIMEType = new char[uValueSize];
|
||||
if(pNPMgtBlk->szMIMEType == NULL)
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
|
||||
strcpy(pNPMgtBlk->szMIMEType, (const char*)lpBuffer);
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Fetches the "File Extents" string from the DLL VERSIONINFO structure.
|
||||
// "pVersionInfo" is ptr to the VERSIONINFO data, and "pNPMgtBlk" is a handle
|
||||
// to a plugin management data structure created during fe_RegisterPlugin().
|
||||
// The string is copied from the VERSIONINFO data into the
|
||||
// "pNPMgtBlk->szFileExtents" member.
|
||||
// An error is returned if out of memory, but the extents string is not
|
||||
// required, so it is not an error if the string does not exist.
|
||||
NPError wfe_GetPluginExtents(VS_FIXEDFILEINFO* pVersionInfo,
|
||||
NPPMgtBlk* pNPMgtBlk)
|
||||
{ // get the file extent list of this plugin
|
||||
pNPMgtBlk->szFileExtents = NULL;
|
||||
|
||||
static char szFileExtentsBlock[] = "StringFileInfo\\040904E4\\FileExtents";
|
||||
void* lpBuffer = NULL;
|
||||
UINT uValueSize = 0;
|
||||
|
||||
if(::VerQueryValue(pVersionInfo, szFileExtentsBlock,
|
||||
&lpBuffer, &uValueSize) == 0)
|
||||
// couldn't find file extent
|
||||
return NPERR_NO_ERROR;
|
||||
|
||||
if((*((char*)lpBuffer) == '\0') || (uValueSize == 0)) // no extents
|
||||
return NPERR_NO_ERROR;
|
||||
|
||||
// alloc char array
|
||||
pNPMgtBlk->szFileExtents = new char[uValueSize];
|
||||
if(pNPMgtBlk->szFileExtents == NULL)
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
strcpy(pNPMgtBlk->szFileExtents, (const char*)lpBuffer);
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Fetches the "File Open Template" string from the DLL VERSIONINFO structure.
|
||||
// "pVersionInfo" is ptr to the VERSIONINFO data, and "pNPMgtBlk" is a handle
|
||||
// to a plugin management data structure created during fe_RegisterPlugin().
|
||||
// The string is copied from the VERSIONINFO data into the
|
||||
// "pNPMgtBlk->szFileOpenName" member.
|
||||
// An error is returned if out of memory, but the template string is not
|
||||
// required, so it is not an error if the string does not exist.
|
||||
NPError wfe_GetPluginFileOpenTemplate(VS_FIXEDFILEINFO* pVersionInfo,
|
||||
NPPMgtBlk* pNPMgtBlk)
|
||||
{ // get the file open template this plugin
|
||||
pNPMgtBlk->szFileOpenName = NULL;
|
||||
|
||||
static char szFileOpenBlock[] = "StringFileInfo\\040904E4\\FileOpenName";
|
||||
void* lpBuffer = NULL;
|
||||
UINT uValueSize = 0;
|
||||
|
||||
if(::VerQueryValue(pVersionInfo, szFileOpenBlock,
|
||||
&lpBuffer, &uValueSize) == 0)
|
||||
// couldn't find file extent
|
||||
return NPERR_NO_ERROR;
|
||||
|
||||
if((*((char*)lpBuffer) == '\0') || (uValueSize == 0)) // no extents
|
||||
return NPERR_NO_ERROR;
|
||||
|
||||
// alloc char array
|
||||
pNPMgtBlk->szFileOpenName = new char[uValueSize];
|
||||
if(pNPMgtBlk->szFileOpenName == NULL)
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
strcpy(pNPMgtBlk->szFileOpenName, (const char*)lpBuffer);
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Fetches the plugin name and description from the resource info.
|
||||
// Uses predefined version information strings
|
||||
NPError wfe_GetPluginNameAndDescription(VS_FIXEDFILEINFO* pVersionInfo,
|
||||
CString& strName,
|
||||
CString& strDescription)
|
||||
{
|
||||
static char szNameBlock[] = "StringFileInfo\\040904E4\\ProductName";
|
||||
static char szDescBlock[] = "StringFileInfo\\040904E4\\FileDescription";
|
||||
void* lpBuffer = NULL;
|
||||
UINT uValueSize = 0;
|
||||
|
||||
// Get the product name
|
||||
if(::VerQueryValue(pVersionInfo, szNameBlock, &lpBuffer, &uValueSize) > 0)
|
||||
strName = (LPSTR)lpBuffer;
|
||||
|
||||
// Get the file description
|
||||
if(::VerQueryValue(pVersionInfo, szDescBlock, &lpBuffer, &uValueSize) > 0)
|
||||
strDescription = (LPSTR)lpBuffer;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Loads plugin properties from the DLL VERSIONINFO data structure.
|
||||
// MIME type and version are required, but file extents and string
|
||||
// file open templates are optional. "pPluginFilespec" is a string
|
||||
// containing the file name of a DLL. "pNPMgtBlk" is a handle to a
|
||||
// plugin management data structure created during fe_RegisterPlugin().
|
||||
// Returns an error if "pPluginFilespec" did not have the required MIME
|
||||
// type and version fields.
|
||||
//
|
||||
// Also returns the plugin name and description
|
||||
NPError wfe_GetPluginProperties(char* pPluginFilespec,
|
||||
NPPMgtBlk* pNPMgtBlk,
|
||||
CString& strPluginName,
|
||||
CString& strPluginDescription)
|
||||
{
|
||||
// prepare to read the version info tags
|
||||
DWORD dwHandle = NULL;
|
||||
DWORD dwVerInfoSize = ::GetFileVersionInfoSize(pPluginFilespec, &dwHandle);
|
||||
if(dwVerInfoSize == NULL)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
VS_FIXEDFILEINFO* pVersionInfo =
|
||||
(VS_FIXEDFILEINFO*)new char[dwVerInfoSize];
|
||||
if(pVersionInfo == NULL)
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
|
||||
if(::GetFileVersionInfo(pPluginFilespec, dwHandle,
|
||||
dwVerInfoSize, pVersionInfo) == 0)
|
||||
{
|
||||
delete [] (char*)pVersionInfo;
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
NPError result;
|
||||
// get the mime type of this plugin
|
||||
if((result = wfe_GetPluginMIMEType(pVersionInfo, pNPMgtBlk))
|
||||
!= NPERR_NO_ERROR)
|
||||
{
|
||||
delete [] (char*)pVersionInfo;
|
||||
return result;
|
||||
}
|
||||
|
||||
// get the file extent list of this plugin
|
||||
if((result = wfe_GetPluginExtents(pVersionInfo, pNPMgtBlk))
|
||||
!= NPERR_NO_ERROR)
|
||||
|
||||
{
|
||||
delete [] pNPMgtBlk->szMIMEType;
|
||||
delete [] (char*)pVersionInfo;
|
||||
return result;
|
||||
}
|
||||
|
||||
// get the file type template string of this plugin
|
||||
if((result = wfe_GetPluginFileOpenTemplate(pVersionInfo, pNPMgtBlk))
|
||||
!= NPERR_NO_ERROR)
|
||||
|
||||
{
|
||||
delete [] pNPMgtBlk->szFileExtents;
|
||||
delete [] pNPMgtBlk->szMIMEType;
|
||||
delete [] (char*)pVersionInfo;
|
||||
return result;
|
||||
}
|
||||
|
||||
// get the version of this plugin
|
||||
void* lpBuffer = NULL;
|
||||
UINT uValueSize = 0;
|
||||
if(::VerQueryValue(pVersionInfo, "\\", &lpBuffer, &uValueSize) == 0)
|
||||
{ // couldn't find versioninfo
|
||||
delete [] pNPMgtBlk->szFileExtents;
|
||||
delete [] pNPMgtBlk->szMIMEType;
|
||||
delete [] (char*)pVersionInfo;
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
pNPMgtBlk->versionMS = ((VS_FIXEDFILEINFO*)lpBuffer)->dwProductVersionMS;
|
||||
pNPMgtBlk->versionLS = ((VS_FIXEDFILEINFO*)lpBuffer)->dwProductVersionLS;
|
||||
|
||||
// get the plugin name and description. It's not fatal if these fail
|
||||
wfe_GetPluginNameAndDescription(pVersionInfo, strPluginName, strPluginDescription);
|
||||
|
||||
delete [] (char*)pVersionInfo;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Given a file open filter, e.g. Text Documents(*.txt), extracts the
|
||||
// description and returns a copy of it
|
||||
static LPSTR
|
||||
ExtractDescription(LPCSTR lpszFileOpenFilter)
|
||||
{
|
||||
ASSERT(lpszFileOpenFilter);
|
||||
|
||||
LPSTR lpszDescription = XP_STRDUP(lpszFileOpenFilter);
|
||||
|
||||
// Strip off an filter pattern at the end
|
||||
LPSTR lpszPattern = strrchr(lpszDescription, '(');
|
||||
|
||||
if (lpszPattern)
|
||||
*lpszPattern = '\0';
|
||||
|
||||
return lpszDescription;
|
||||
}
|
||||
|
||||
// Registers one plugin. "pPluginFilespec" is a string containing the file
|
||||
// name of a DLL.
|
||||
// This function can be called more than once so a plugin which has copied
|
||||
// into the plugins subdir AFTER the Nav has started can be registered
|
||||
// and loaded.
|
||||
// The DLL is a plugin candidate, and is qualified during
|
||||
// this function, by checking the DLL VERSIONINFO data structure for a
|
||||
// MIME type string. If this string is found successfully, the handle
|
||||
// of the management block is used to register the plugin for its MIME type.
|
||||
// The extents which are to be associated with this MIME type are also grokked
|
||||
// from the VERSIONINFO data structure, once the candidate is accepted.
|
||||
// This function also takes the opportunity to overrided any helper app, by
|
||||
// setting a helper app data structure member to allow the plugin to handle
|
||||
// the MIME type instead of the helper, (pApp->how_handle = HANDLE_VIA_PLUGIN).
|
||||
// Returns an error if "pPluginFilespec" was not registered.
|
||||
NPError fe_RegisterPlugin(char* pPluginFilespec)
|
||||
{
|
||||
CString strName, strDescription;
|
||||
|
||||
// initialize a new plugin list mgt block
|
||||
NPPMgtBlk* pNPMgtBlk = new NPPMgtBlk;
|
||||
if(pNPMgtBlk == NULL) // fatal, can't continue
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
|
||||
pNPMgtBlk->pPluginFuncs = NULL;
|
||||
pNPMgtBlk->pLibrary = NULL;
|
||||
pNPMgtBlk->uRefCount = 0;
|
||||
pNPMgtBlk->next = NULL;
|
||||
|
||||
// determine the MIME type and version of this plugin
|
||||
if(wfe_GetPluginProperties(pPluginFilespec, pNPMgtBlk, strName, strDescription) != NPERR_NO_ERROR)
|
||||
{
|
||||
delete pNPMgtBlk;
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
// if a plugin is already registered for this MIME type, return. this
|
||||
// allows downloading and registering new plugins without exiting the nav
|
||||
for(NPPMgtBlk* pListBlk = g_pRegisteredPluginList; pListBlk != NULL;
|
||||
pListBlk = pListBlk->next) {
|
||||
BOOL bSameFile =
|
||||
(strcmp(pListBlk->pPluginFilename, pPluginFilespec) == 0);
|
||||
BOOL bSameMIMEtype =
|
||||
(strstr(pNPMgtBlk->szMIMEType, pListBlk->szMIMEType) != NULL);
|
||||
if(bSameFile && bSameMIMEtype) {
|
||||
// the plugin DLL's filename and the MIME type it's registering for
|
||||
// are the same, don't reregister
|
||||
delete pNPMgtBlk;
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
pNPMgtBlk->pPluginFilename = XP_STRDUP(pPluginFilespec);
|
||||
if(pNPMgtBlk->pPluginFilename == NULL) // fatal, can't continue
|
||||
{
|
||||
delete pNPMgtBlk;
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
// Register the plugin file with the XP plugin code
|
||||
NPL_RegisterPluginFile(strName, pNPMgtBlk->pPluginFilename, strDescription,
|
||||
pNPMgtBlk);
|
||||
|
||||
// Iterate through the filename extensions. These are a list which are
|
||||
// delimited via the '|' character. The list of MIME Types,File Extents,
|
||||
// and Open Names must all coordinate
|
||||
char *pStartMIME, *pEndMIME, *pStartExt, *pEndExt, *pStartName, *pEndName;
|
||||
|
||||
pStartMIME = pNPMgtBlk->szMIMEType;
|
||||
pStartExt = pNPMgtBlk->szFileExtents;
|
||||
pStartName = pNPMgtBlk->szFileOpenName;
|
||||
|
||||
pEndMIME = strchr(pStartMIME ,'|');
|
||||
while (pEndMIME) {
|
||||
pEndExt = strchr(pStartExt,'|');
|
||||
pEndName = strchr(pStartName,'|');
|
||||
if (pEndMIME) *pEndMIME = 0;
|
||||
else return NPERR_GENERIC_ERROR;
|
||||
if (pEndExt) *pEndExt = 0;
|
||||
else return NPERR_GENERIC_ERROR;
|
||||
if (pEndName) *pEndName = 0;
|
||||
else return NPERR_GENERIC_ERROR;
|
||||
|
||||
// Register the MIME type with the XP plugin code. We need to pass in
|
||||
// a description. If there's a file open template specified, then use the
|
||||
// description from there. Otherwise use the MIME type
|
||||
LPSTR lpszDescription = NULL;
|
||||
|
||||
if (pStartName)
|
||||
lpszDescription = ExtractDescription(pStartName);
|
||||
|
||||
NPL_RegisterPluginType(pStartMIME, (LPCSTR)pStartExt, lpszDescription ?
|
||||
lpszDescription : pStartMIME, (void *)pStartName, pNPMgtBlk, TRUE);
|
||||
|
||||
if (lpszDescription)
|
||||
XP_FREE(lpszDescription);
|
||||
|
||||
CHelperApp *pApp;
|
||||
if(theApp.m_HelperListByType.Lookup(pStartMIME, (CObject *&)pApp)) {
|
||||
// We've a match.
|
||||
// Make sure the app is marked to handle the load
|
||||
// via a plugin
|
||||
pApp->how_handle = HANDLE_VIA_PLUGIN;
|
||||
}
|
||||
|
||||
if ((pEndMIME+1) && (pEndExt+1) && (pEndName+1)) {
|
||||
pStartMIME = pEndMIME+1;
|
||||
pStartExt = pEndExt+1;
|
||||
pStartName = pEndName+1;
|
||||
}
|
||||
pEndMIME = strchr(pStartMIME ,'|');
|
||||
}
|
||||
|
||||
// Register the MIME type with the XP plugin code. We need to pass in
|
||||
// a description. If there's a file open template specified, then use the
|
||||
// description from there. Otherwise use the MIME type
|
||||
LPSTR lpszDescription = NULL;
|
||||
|
||||
if (pStartName)
|
||||
lpszDescription = ExtractDescription(pStartName);
|
||||
|
||||
NPL_RegisterPluginType(pStartMIME, (LPCSTR)pStartExt, lpszDescription ?
|
||||
lpszDescription : pStartMIME, (void *)pStartName, pNPMgtBlk, TRUE);
|
||||
|
||||
if (lpszDescription)
|
||||
XP_FREE(lpszDescription);
|
||||
|
||||
CHelperApp *pApp;
|
||||
if(theApp.m_HelperListByType.Lookup(pStartMIME, (CObject *&)pApp)) {
|
||||
// We've a match.
|
||||
// Make sure the app is marked to handle the load
|
||||
// via a plugin
|
||||
pApp->how_handle = HANDLE_VIA_PLUGIN;
|
||||
}
|
||||
|
||||
// insert the plugin mgt blk at the head of the list of registered plugins.
|
||||
// this means they are listed in the reverse order from which they were
|
||||
// created, which doesn't matter.
|
||||
pNPMgtBlk->next = g_pRegisteredPluginList;
|
||||
g_pRegisteredPluginList = pNPMgtBlk;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kPluginManagerCID, NS_PLUGINMANAGER_CID);
|
||||
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
||||
|
||||
// FE_RegisterPlugins is called from navigator main via npglue's NP_Init(). Finds all
|
||||
// plugins and begins tracking them using a NPPMgtBlk. Uses the NPPMgtBlk
|
||||
// block handle to register the plugin with the xp plugin glue. Looks
|
||||
// in the directory under the netscape.exe dir, named "plugins" and all
|
||||
// subdirectories in recursive way (see fe_RegisterPlugins). If the
|
||||
// directory doesn't exist, no warning dialog is shown.
|
||||
// There are no input or return vals.
|
||||
void fe_RegisterPlugins(char* pszPluginDir)
|
||||
{
|
||||
CString csPluginSpec;
|
||||
csPluginSpec = pszPluginDir;
|
||||
|
||||
#if defined(JAVA)
|
||||
// add directory to the java path no matter what
|
||||
LJ_AddToClassPath(pszPluginDir);
|
||||
#endif
|
||||
|
||||
csPluginSpec += "\\*.*";
|
||||
|
||||
#ifndef _WIN32
|
||||
_find_t fileinfo;
|
||||
unsigned result = _dos_findfirst((LPSTR)((LPCSTR)csPluginSpec), _A_NORMAL | _A_SUBDIR, &fileinfo );
|
||||
|
||||
if (result == 0) {
|
||||
|
||||
result = _dos_findnext(&fileinfo); // skip "."
|
||||
result = _dos_findnext(&fileinfo); // skip ".."
|
||||
|
||||
CString csFileSpec;
|
||||
|
||||
while(result == 0)
|
||||
{
|
||||
csFileSpec = pszPluginDir;
|
||||
csFileSpec += "\\";
|
||||
csFileSpec += fileinfo.name;
|
||||
|
||||
// we got a subdir, call recursively this function to load plugin
|
||||
if (fileinfo.attrib & _A_SUBDIR ) {
|
||||
fe_RegisterPlugins((LPSTR)(LPCSTR)csFileSpec);
|
||||
}
|
||||
else {
|
||||
size_t len = strlen(fileinfo.name);
|
||||
|
||||
// it's a file, see if it can be a plugin file
|
||||
if ( len > 6 && // at least "np.dll"
|
||||
(fileinfo.name[0] == 'n' || fileinfo.name[0] == 'N') &&
|
||||
(fileinfo.name[1] == 'p' || fileinfo.name[1] == 'P') &&
|
||||
!_stricmp(fileinfo.name + len - 4, ".dll"))
|
||||
fe_RegisterPlugin((LPSTR)((LPCSTR)csFileSpec));
|
||||
#ifdef EDITOR
|
||||
// If it's a cpXXX.zip file,register it as a composer plugin.
|
||||
else if ( len > 6 && // at least cp.zip
|
||||
(fileinfo.name[0] == 'c' || fileinfo.name[0] == 'C') &&
|
||||
(fileinfo.name[1] == 'p' || fileinfo.name[1] == 'P') &&
|
||||
(!_stricmp(fileinfo.name + len - 4, ".zip")
|
||||
|| !_stricmp(fileinfo.name + len - 4, ".jar"))
|
||||
)
|
||||
EDT_RegisterPlugin((LPSTR)((LPCSTR)csFileSpec));
|
||||
#endif /* EDITOR */
|
||||
}
|
||||
result = _dos_findnext(&fileinfo);
|
||||
}
|
||||
}
|
||||
#else /* _WIN32 */
|
||||
_finddata_t fileinfo;
|
||||
unsigned handle = _findfirst((LPSTR)((LPCSTR)csPluginSpec), &fileinfo );
|
||||
unsigned result = 0;
|
||||
|
||||
if (handle != -1) {
|
||||
result = _findnext(handle, &fileinfo); // skip "."
|
||||
result = _findnext(handle, &fileinfo); // skip ".."
|
||||
|
||||
|
||||
CString csFileSpec;
|
||||
|
||||
while((result != -1) && (handle != -1))
|
||||
{
|
||||
csFileSpec = pszPluginDir;
|
||||
csFileSpec += "\\";
|
||||
csFileSpec += fileinfo.name;
|
||||
|
||||
// we got a subdir, call recursively this function to load plugin
|
||||
if (fileinfo.attrib & _A_SUBDIR ) {
|
||||
fe_RegisterPlugins((LPSTR)(LPCSTR)csFileSpec);
|
||||
}
|
||||
else {
|
||||
size_t len = strlen(fileinfo.name);
|
||||
|
||||
// it's a file, see if it can be a plugin file
|
||||
if ( len > 6 && // at least "np.dll"
|
||||
(fileinfo.name[0] == 'n' || fileinfo.name[0] == 'N') &&
|
||||
(fileinfo.name[1] == 'p' || fileinfo.name[1] == 'P') &&
|
||||
!_stricmp(fileinfo.name + len - 4, ".dll"))
|
||||
fe_RegisterPlugin((LPSTR)((LPCSTR)csFileSpec));
|
||||
#ifdef EDITOR
|
||||
// If it's a cpXXX.zip file, add it to the java class path.
|
||||
else if ( len > 6 && // at least cp.zip
|
||||
(fileinfo.name[0] == 'c' || fileinfo.name[0] == 'C') &&
|
||||
(fileinfo.name[1] == 'p' || fileinfo.name[1] == 'P') &&
|
||||
(!_stricmp(fileinfo.name + len - 4, ".zip")
|
||||
|| !_stricmp(fileinfo.name + len - 4, ".jar"))
|
||||
)
|
||||
EDT_RegisterPlugin((LPSTR)((LPCSTR)csFileSpec));
|
||||
#endif
|
||||
}
|
||||
result = _findnext(handle, &fileinfo);
|
||||
}
|
||||
_findclose(handle);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
// called from the navigator main, dispatch to the previous function
|
||||
void FE_RegisterPlugins()
|
||||
{
|
||||
CString csPluginDir;
|
||||
// get the main plugins directory and start the process
|
||||
wfe_GetPluginsDirectory(csPluginDir);
|
||||
fe_RegisterPlugins((LPSTR)(LPCSTR)csPluginDir);
|
||||
CString csJavaDir;
|
||||
wfe_GetJavaDirectory(csJavaDir);
|
||||
JVM_AddToClassPath(csJavaDir);
|
||||
}
|
||||
|
||||
// saves the current path in the variable passed. ppPathSave is the
|
||||
// address of the ptr which stores the path string. returns out of memory
|
||||
// error if allocation for the string returned by _getcwd() fails. returns
|
||||
// generic error if the "one deep" stack is already full.
|
||||
NPError wfe_PushPath(LPSTR *ppPathSave)
|
||||
{
|
||||
// only allow "one deep" stack
|
||||
if(*ppPathSave != NULL)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
// save the CWD
|
||||
*ppPathSave = _getcwd(NULL, 0);
|
||||
if(*ppPathSave == NULL)
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// calculate the drive letter value for _chdrive(). ascii in, int out
|
||||
int wfe_MapAsciiToDriveNum(char cAsciiNum)
|
||||
{
|
||||
int iDriveLetter = cAsciiNum;
|
||||
if(islower(cAsciiNum))
|
||||
iDriveLetter = _toupper(cAsciiNum);
|
||||
// plus one because for _chdrive(), A = 1, B = 2, etc
|
||||
return iDriveLetter - 'A' + 1;
|
||||
}
|
||||
|
||||
// restores the path from the variable passed. pDirSave stores the pointer
|
||||
// to the path string. returns an error if a path has never been pushed.
|
||||
NPError wfe_PopPath(LPSTR pPathSave)
|
||||
{
|
||||
// only allows "one deep" stack
|
||||
if(pPathSave == NULL)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
// restore the drive
|
||||
int chdriveErr = _chdrive(wfe_MapAsciiToDriveNum(pPathSave[0]));
|
||||
|
||||
// restore the CWD
|
||||
int chdirErr = _chdir(pPathSave);
|
||||
free(pPathSave);
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
static void
|
||||
fe_MaybeUnloadPlugin(NPPMgtBlk* mgtBlock)
|
||||
{
|
||||
nsCanUnloadProc nsCanUnload = (nsCanUnloadProc)
|
||||
PR_FindSymbol(mgtBlock->pLibrary, "NSCanUnload");
|
||||
if (nsCanUnload) {
|
||||
PRBool canUnload = nsCanUnload();
|
||||
if (canUnload) {
|
||||
PR_UnloadLibrary(mgtBlock->pLibrary);
|
||||
mgtBlock->pLibrary = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load a plugin dll. "pluginType" is a handle to a plugin management data
|
||||
// structure created during FE_RegisterPlugins(). "pNavigatorFuncs" is
|
||||
// a table of entry points into Navigator, which are the services provided
|
||||
// by Navigator to plugins, such as requestread() and GetUrl(). These entry
|
||||
// points are stored and called by the plugin when services are needed.
|
||||
// The return val is a table of functions which are entry points to the
|
||||
// newly loaded plugin, such as NewStream() and Write().
|
||||
NPPluginFuncs* FE_LoadPlugin(void* pluginType, NPNetscapeFuncs* pNavigatorFuncs, np_handle* handle)
|
||||
{
|
||||
if(pluginType == NULL)
|
||||
return NULL;
|
||||
|
||||
NPPMgtBlk* pNPMgtBlock = (NPPMgtBlk*)pluginType;
|
||||
|
||||
CString csPluginDir;
|
||||
#ifdef OJI
|
||||
char* szExplicitDLL = strrchr(pNPMgtBlock->pPluginFilename, '\\');
|
||||
if( szExplicitDLL ) {
|
||||
csPluginDir = pNPMgtBlock->pPluginFilename; // MFC copies the string
|
||||
csPluginDir.SetAt( szExplicitDLL - pNPMgtBlock->pPluginFilename, '\0');
|
||||
} else {
|
||||
wfe_GetPluginsDirectory(csPluginDir);
|
||||
}
|
||||
#else
|
||||
wfe_GetPluginsDirectory(csPluginDir);
|
||||
#endif /* OJI */
|
||||
|
||||
LPSTR pPathSave = NULL; // storage for one dir spec
|
||||
|
||||
wfe_PushPath(&pPathSave); // save the current drive and dir
|
||||
|
||||
// change the default dir so that implib'd plugins won't fail
|
||||
if(_chdir(csPluginDir) != 0) {
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// must change the drive as well as the dir path
|
||||
if(isalpha(csPluginDir[0]) && csPluginDir[1] == ':') {
|
||||
if(_chdrive(wfe_MapAsciiToDriveNum(csPluginDir[0])) != 0) {
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
pNPMgtBlock->pLibrary = PR_LoadLibrary(pNPMgtBlock->pPluginFilename);
|
||||
|
||||
// the cross platform code should take care of the 16/32 bit issues
|
||||
if(pNPMgtBlock->pLibrary == NULL)
|
||||
return NULL;
|
||||
|
||||
nsFactoryProc nsGetFactory = (nsFactoryProc)
|
||||
PR_FindSymbol(pNPMgtBlock->pLibrary, "NSGetFactory");
|
||||
if (nsGetFactory != NULL) {
|
||||
static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
|
||||
nsIPlugin* plugin = NULL;
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
nsresult res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK
|
||||
&& (res = nsGetFactory(kIPluginIID, (nsIFactory**)&plugin, serviceMgr)) == NS_OK) {
|
||||
|
||||
handle->userPlugin = plugin;
|
||||
plugin->AddRef(); // the browser's reference
|
||||
pNPMgtBlock->pPluginFuncs = (NPPluginFuncs*)-1; // something to say it's loaded, but != 0
|
||||
#ifdef LATER // XXX coming soon...
|
||||
// add the plugin directory if successful
|
||||
JVM_AddToClassPathRecursively(csPluginDir);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlock);
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
NP_GETENTRYPOINTS getentrypoints =
|
||||
(NP_GETENTRYPOINTS)PR_FindSymbol(pNPMgtBlock->pLibrary, "NP_GetEntryPoints");
|
||||
if(getentrypoints == NULL)
|
||||
{
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlock);
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(pNPMgtBlock->pPluginFuncs == NULL)
|
||||
{
|
||||
pNPMgtBlock->pPluginFuncs = new NPPluginFuncs;
|
||||
pNPMgtBlock->pPluginFuncs->size = sizeof NPPluginFuncs;
|
||||
pNPMgtBlock->pPluginFuncs->javaClass = NULL;
|
||||
if(pNPMgtBlock->pPluginFuncs == NULL) // fatal, can't continue
|
||||
{
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlock);
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(getentrypoints(pNPMgtBlock->pPluginFuncs) != NPERR_NO_ERROR)
|
||||
{
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlock);
|
||||
delete pNPMgtBlock->pPluginFuncs;
|
||||
pNPMgtBlock->pPluginFuncs = NULL;
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// if the plugin's major ver level is lower than the Navigator's,
|
||||
// then they are incompatible, and should return an error
|
||||
if(HIBYTE(pNPMgtBlock->pPluginFuncs->version) < NP_VERSION_MAJOR)
|
||||
{
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlock);
|
||||
delete pNPMgtBlock->pPluginFuncs;
|
||||
pNPMgtBlock->pPluginFuncs = NULL;
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NP_PLUGININIT npinit = NULL;
|
||||
|
||||
// if this DLL is not already loaded, call its initialization entry point
|
||||
if(pNPMgtBlock->uRefCount == 0) {
|
||||
// the NP_Initialize entry point was misnamed as NP_PluginInit, early
|
||||
// in plugin project development. Its correct name is documented
|
||||
// now, and new developers expect it to work. However, I don't want
|
||||
// to break the plugins already in the field, so I'll accept either
|
||||
// name
|
||||
npinit =
|
||||
(NP_PLUGININIT)PR_FindSymbol(pNPMgtBlock->pLibrary, "NP_Initialize");
|
||||
if(!npinit) {
|
||||
npinit =
|
||||
(NP_PLUGININIT)PR_FindSymbol(pNPMgtBlock->pLibrary, "NP_PluginInit");
|
||||
}
|
||||
}
|
||||
|
||||
if(npinit == NULL) {
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlock);
|
||||
delete pNPMgtBlock->pPluginFuncs;
|
||||
pNPMgtBlock->pPluginFuncs = NULL;
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (npinit(pNavigatorFuncs) != NPERR_NO_ERROR) {
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlock);
|
||||
delete pNPMgtBlock->pPluginFuncs;
|
||||
pNPMgtBlock->pPluginFuncs = NULL;
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
pNPMgtBlock->uRefCount++; // all is well, remember it was loaded
|
||||
|
||||
// can't pop the path until plugins have been completely loaded/init'd
|
||||
wfe_PopPath(pPathSave); // restore the path
|
||||
return pNPMgtBlock->pPluginFuncs;
|
||||
}
|
||||
|
||||
// Unloads a plugin DLL. "pluginType" is a handle to a plugin management data
|
||||
// structure created during FE_RegisterPlugins(). There is no return val.
|
||||
void FE_UnloadPlugin(void* pluginType, struct _np_handle* handle)
|
||||
{
|
||||
NPPMgtBlk* pNPMgtBlk = (NPPMgtBlk*)pluginType;
|
||||
if (pNPMgtBlk == NULL)
|
||||
return;
|
||||
|
||||
// XXX Note that we're double refcounting here. If we were rewriting this
|
||||
// from scratch, we could eliminate this pNPMgtBlk and its refcount and just
|
||||
// rely on the one in the userPlugin.
|
||||
|
||||
pNPMgtBlk->uRefCount--; // another one bites the dust
|
||||
|
||||
// if this DLL is the last one, call its shutdown entry point
|
||||
if (pNPMgtBlk->uRefCount == 0) {
|
||||
if (handle->userPlugin) {
|
||||
nsrefcnt cnt = handle->userPlugin->Release();
|
||||
#if 0 // XXX later...
|
||||
// remove the plugin directory if successful
|
||||
JVM_RemoveFromClassPathRecursively(csPluginDir);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// the NP_Shutdown entry point was misnamed as NP_PluginShutdown, early
|
||||
// in plugin project development. Its correct name is documented
|
||||
// now, and new developers expect it to work. However, I don't want
|
||||
// to break the plugins already in the field, so I'll accept either
|
||||
// name
|
||||
NP_PLUGINSHUTDOWN npshutdown =
|
||||
(NP_PLUGINSHUTDOWN)PR_FindSymbol(pNPMgtBlk->pLibrary, "NP_Shutdown");
|
||||
if (!npshutdown) {
|
||||
npshutdown =
|
||||
(NP_PLUGINSHUTDOWN)PR_FindSymbol(pNPMgtBlk->pLibrary, "NP_PluginShutdown");
|
||||
}
|
||||
|
||||
if (npshutdown != NULL) {
|
||||
NPError result = npshutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlk);
|
||||
|
||||
if (handle->userPlugin) {
|
||||
PR_ASSERT(pNPMgtBlk->pPluginFuncs == (NPPluginFuncs*)-1); // set in FE_LoadPlugin
|
||||
handle->userPlugin = NULL;
|
||||
}
|
||||
else {
|
||||
delete pNPMgtBlk->pPluginFuncs;
|
||||
}
|
||||
pNPMgtBlk->pPluginFuncs = NULL;
|
||||
}
|
||||
|
||||
// Removes a plugin DLL from memory, and frees its NPPMgtBlk management block.
|
||||
// "pluginType" is a handle to the plugin management data structure created
|
||||
// during FE_RegisterPlugins(). There is no return val.
|
||||
void FE_UnregisterPlugin(void* pluginType)
|
||||
{
|
||||
NPPMgtBlk* pNPMgtBlk = (NPPMgtBlk*)pluginType;
|
||||
if(pNPMgtBlk == NULL)
|
||||
return;
|
||||
|
||||
if(pNPMgtBlk->pLibrary != NULL)
|
||||
fe_MaybeUnloadPlugin(pNPMgtBlk);
|
||||
|
||||
delete [] (char*)*pNPMgtBlk->pPluginFilename;
|
||||
delete [] pNPMgtBlk->pPluginFilename;
|
||||
delete [] pNPMgtBlk->szMIMEType;
|
||||
delete pNPMgtBlk->pPluginFuncs;
|
||||
delete pNPMgtBlk;
|
||||
}
|
||||
|
||||
// Provides the entry point used by xp plugin code, (NPGLUE.C), to control
|
||||
// scroll bars. The inputs are obvious, and there is no return val.
|
||||
void FE_ShowScrollBars(MWContext* pContext, XP_Bool show)
|
||||
{
|
||||
if(ABSTRACTCX(pContext)->IsWindowContext()) {
|
||||
CPaneCX *pPaneCX = PANECX(pContext);
|
||||
|
||||
pPaneCX->ShowScrollBars(SB_BOTH, show);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XP_WIN32
|
||||
void*
|
||||
WFE_BeginSetModuleState()
|
||||
{
|
||||
return AfxSetModuleState(AfxGetAppModuleState());
|
||||
}
|
||||
|
||||
void
|
||||
WFE_EndSetModuleState(void* pPrevState)
|
||||
{
|
||||
AfxSetModuleState((AFX_MODULE_STATE*)pPrevState);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
1307
mozilla/cmd/winfe/woohoo.cpp
Normal file
1307
mozilla/cmd/winfe/woohoo.cpp
Normal file
File diff suppressed because it is too large
Load Diff
86
mozilla/cmd/xfe/C
Normal file
86
mozilla/cmd/xfe/C
Normal file
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# $XConsortium: C,v 1.4 91/06/29 20:01:32 xguest Exp $
|
||||
#
|
||||
# Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
|
||||
# and Nippon Telegraph and Telephone Corporation
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the names of OMRON, NTT Software, NTT, and M.I.T.
|
||||
# not be used in advertising or publicity pertaining to distribution of the
|
||||
# software without specific, written prior permission. OMRON, NTT Software,
|
||||
# NTT, and M.I.T. make no representations about the suitability of this
|
||||
# software for any purpose. It is provided "as is" without express or
|
||||
# implied warranty.
|
||||
#
|
||||
# OMRON, NTT SOFTWARE, NTT, AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD
|
||||
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, NTT, OR M.I.T. BE
|
||||
# LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# Author: Li Yuhong OMRON Corporation
|
||||
#
|
||||
########################################################################
|
||||
#
|
||||
# Locale Name: C
|
||||
#
|
||||
XLC_ALL
|
||||
C
|
||||
END XLC_ALL
|
||||
|
||||
XLC_ENCODING
|
||||
STRING
|
||||
END XLC_ENCODING
|
||||
|
||||
XLC_FONTSET
|
||||
#
|
||||
# Definition Format: XLFD
|
||||
#
|
||||
# ASCII: ISO 8859-1
|
||||
iso8859-1:GL
|
||||
END XLC_FONTSET
|
||||
|
||||
XLC_CODESET
|
||||
#
|
||||
# type:CS0_mblen
|
||||
#
|
||||
L:1
|
||||
#
|
||||
# This mapping list was generated by program, DO NOT CHANGE IT!
|
||||
#
|
||||
#00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
|
||||
#
|
||||
{
|
||||
C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0,
|
||||
C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0, C0,
|
||||
CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,
|
||||
CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,
|
||||
CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,
|
||||
CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,
|
||||
CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,
|
||||
CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,CS0,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND, ND,
|
||||
}
|
||||
#
|
||||
# The following conversion list is hexdecimal.
|
||||
#
|
||||
# CS0: ASCII, ISO 8859-1
|
||||
#
|
||||
(20=20:7f)
|
||||
END XLC_CODESET
|
||||
#
|
||||
# END OF FILE
|
||||
#
|
||||
301
mozilla/cmd/xfe/DtWidgets/ComboBox.README
Normal file
301
mozilla/cmd/xfe/DtWidgets/ComboBox.README
Normal file
@@ -0,0 +1,301 @@
|
||||
/***********************************************************
|
||||
Copyright 1993 Interleaf, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose without fee is granted,
|
||||
provided that the above copyright notice appear in all copies
|
||||
and that both copyright notice and this permission notice appear
|
||||
in supporting documentation, and that the name of Interleaf not
|
||||
be used in advertising or publicly pertaining to distribution of
|
||||
the software without specific written prior permission.
|
||||
|
||||
Interleaf makes no representation about the suitability of this
|
||||
software for any purpose. It is provided "AS IS" without any
|
||||
express or implied warranty.
|
||||
******************************************************************/
|
||||
|
||||
Notes/Issues:
|
||||
- The list menu is posted on the select button release. In order to
|
||||
be like Windows, the menu would come up on the button press, and allow
|
||||
the user to drag immediately, without letting go of the select button.
|
||||
When I wrote the widget, I didn't have time to investigate getting this
|
||||
drag to work. We would have to simulate the select press inside the
|
||||
list, I imagine.
|
||||
- No key pattern matching available.
|
||||
- Lack of translation table functionality.
|
||||
|
||||
|
||||
1. ComboBox Widget
|
||||
|
||||
1.1 Widget Class Name
|
||||
|
||||
ComboBox
|
||||
|
||||
1.2 Synopsis
|
||||
|
||||
#include "ComboBox.h"
|
||||
|
||||
widget = DtCreateComboBox(parent, name, arglist, num_args);
|
||||
XtManageChild(widget);
|
||||
|
||||
1.3 Description
|
||||
|
||||
1.4 Resources
|
||||
|
||||
Property Type Init Access
|
||||
-------- ---- ---- ------
|
||||
XmNactivateCallback CallbackList NULL CSG
|
||||
XmNalignment unsigned char XmALIGNMENT_BEGINNING CSG
|
||||
XmNarrowSpacing Dimension 0 CSG
|
||||
XmNarrowSize Dimension dynamic G
|
||||
XmNarrowType unsigned char XmWINDOWS CSG
|
||||
XmNcolumns Integer 20 CSG
|
||||
XmNfocusCallback CallbackList NULL CSG
|
||||
XmNitemCount Unsigned Integer 0 CSG
|
||||
XmNitems XmStringTable NULL CSG
|
||||
XmNlabelString XmString NULL CSG
|
||||
XmNlist Widget NULL G
|
||||
XmNlistFontList FontList NULL CSG
|
||||
XmNlistMarginHeight Dimension 2 CSG
|
||||
XmNlistMarginWidth Dimension 2 CSG
|
||||
XmNlistSpacing Dimension 0 CSG
|
||||
XmNlosingFocusCallback CallbackList NULL CSG
|
||||
XmNmarginHeight Dimension 2 CSG
|
||||
XmNmarginWidth Dimension 2 CSG
|
||||
XmNmaxLength Unsigned Integer MAXINT CSG
|
||||
XmNmenuPostCallback CallbackList NULL CSG
|
||||
XmNorientation unsigned char XmRIGHT CSG
|
||||
XmNpoppedUp Boolean FALSE G
|
||||
XmNrecomputeSize Boolean TRUE CSG
|
||||
XmNselectedItem XmString NULL CSG
|
||||
XmNselectedPosition Unsigned Integer 0 CSG
|
||||
XmNselectionCallback CallbackList NULL CSG
|
||||
XmNtextField Widget NULL G
|
||||
XmNtopItemPosition Unsigned Integer 1 CSG
|
||||
XmNtype unsigned char XmDROP_DOWN_LIST_BOX CSG
|
||||
XmNupdateLabel Boolean TRUE CSG
|
||||
XmNvisibleItemCount Unsigned Integer 10 CSG
|
||||
|
||||
XmNactivateCallback:
|
||||
List of callbacks called when the user does KActivate in
|
||||
the text-field widget (when ComboBox is
|
||||
XmDROP_DOWN_COMBO_BOX). See also XmTextFieldWidget.
|
||||
|
||||
XmNalignment:
|
||||
Alignment of the text within the non-editable label.
|
||||
This only gets used if XmNtype is XmDROP_DOWN_LIST_BOX.
|
||||
Values are:
|
||||
XmALIGNMENT_CENTER, XmALIGNMENT_BEGINNING,
|
||||
XmALIGNMENT_END
|
||||
See also XmLabelWidget
|
||||
|
||||
XmNarrowSpacing:
|
||||
Amount of space between the arrow and the label or
|
||||
text-field (in pixels).
|
||||
|
||||
XmNarrowSize:
|
||||
Height/Width of arrow. This is not a settable resource;
|
||||
it is based on the height of the ComboBox (which is
|
||||
related to the font used).
|
||||
|
||||
XmNarrowType:
|
||||
Type of down arrow displayed in the ComboBox. The legal
|
||||
values are: XmWINDOWS, XmMOTIF
|
||||
|
||||
Xmcolumns:
|
||||
This resource is passed on to the text-field widget.
|
||||
See also XmTextFieldWidget.
|
||||
|
||||
XmNfocusCallback:
|
||||
List of callbacks called when the text-field widget accepts
|
||||
focus (when ComboBox is editable - XmDROP_DOWN_COMBO_BOX).
|
||||
See also XmTextFieldWidget.
|
||||
|
||||
XmNitemCount:
|
||||
Total number of items. This value must be the number of
|
||||
items in XmNitems and must not be negative. It is
|
||||
automatically updated by the widget whenever an item
|
||||
is added or deleted.
|
||||
|
||||
XmNitems:
|
||||
A list of xm-strings which will be displayed in the drop
|
||||
down list box.
|
||||
|
||||
XmNlabelString:
|
||||
This is the string that will be used in the label when the
|
||||
resource XmNupdateLabel is FALSE. This string will remain
|
||||
in the label as long as the XmNupdateLayout resource is
|
||||
FALSE, even if the user picks a new item off the list.
|
||||
|
||||
XmNlist:
|
||||
List widget (which is inside the popup). Gettable only.
|
||||
|
||||
XmNlistFontList:
|
||||
This resource is passed on to the XmListWidget as the
|
||||
XmNfontList resource.
|
||||
See also XmListWidget.
|
||||
|
||||
XmNlistMarginHeight:
|
||||
This resource is passed on to the XmListWidget as the
|
||||
XmNlistMarginHeight resource.
|
||||
See also XmListWidget.
|
||||
|
||||
XmNlistMarginWidth:
|
||||
This resource is passed on to the XmListWidget as the
|
||||
XmNlistMarginWidth resource.
|
||||
See also XmListWidget.
|
||||
|
||||
XmNlistSpacing:
|
||||
This resource is passed on to the XmListWidget as the
|
||||
XmNlistSpacing resource.
|
||||
See also XmListWidget.
|
||||
|
||||
XmNlosingFocusCallback:
|
||||
List of callbacks called when the text-field widget loses
|
||||
focus (when ComboBox is editable - XmDROP_DOWN_COMBO_BOX).
|
||||
See also XmTextFieldWidget.
|
||||
|
||||
XmNmarginHeight:
|
||||
Vertical distance from the beginning of the widget to the
|
||||
start of the shadow. Used for making this widget
|
||||
look like push-buttons, etc.
|
||||
|
||||
XmNmarginWidth:
|
||||
Horizontal distance from the beginning of the widget to
|
||||
the start of the shadow. Used for making this widget
|
||||
look like push-buttons, etc.
|
||||
|
||||
XmNmaxLength:
|
||||
Maximum length of the text string that can be entered into
|
||||
a text-field widget. This resource is passed on to the
|
||||
text-field (when ComboBox is editable - XmDROP_DOWN_COMBO_BOX).
|
||||
See also XmTextFieldWidget.
|
||||
|
||||
XmNmenuPostCallback:
|
||||
List of callbacks called right before the list menu
|
||||
gets put on the screen.
|
||||
|
||||
XmNorientation:
|
||||
Specifies location of down arrow. Legal values are:
|
||||
XmLEFT, XmRIGHT
|
||||
|
||||
XmNpoppedUp:
|
||||
Returns TRUE if the list menu is mapped; otherwise, FALSE.
|
||||
|
||||
XmNrecomputeSize:
|
||||
If FALSE, the widget will not try to recompute a new
|
||||
size if setting some other resource would cause it
|
||||
to grow or shrink.
|
||||
|
||||
XmNselectedItem:
|
||||
Item currently visible in list. Can be used to
|
||||
change selected item. User must make copy of this
|
||||
before modifying.
|
||||
|
||||
XmNselectedPosition:
|
||||
Position of item, within scrolling list, currently
|
||||
visible (in label or text-field). Can be used
|
||||
to change selected item. Starts at 0.
|
||||
|
||||
XmNselectionCallback:
|
||||
List of callbacks called when the user selects something
|
||||
off the list (the list's XmNdefaultActionCallback or
|
||||
XmNbrowseSelectionCallback callbacks).
|
||||
See also XmListWidget.
|
||||
|
||||
XmNtextField:
|
||||
text-field widget used within the ComboBox when
|
||||
XmNtype is XmDROP_DOWN_COMBO_BOX.
|
||||
|
||||
XmNtopItemPosition:
|
||||
This resource is passed on to the XmListWidget as the
|
||||
XmNtopItemPosition resource.
|
||||
See also XmListWidget.
|
||||
|
||||
XmNtype:
|
||||
Type of combo-box create. Legal values are:
|
||||
XmDROP_DOWN_LIST_BOX (non-editable, uses label)
|
||||
XmDROP_DOWN_COMBO_BOX (editable, uses text-field)
|
||||
|
||||
XmNupdateLabel:
|
||||
If TRUE, the contents of the label will change when the
|
||||
user picks a new item off the list. If FALSE, the
|
||||
label will not update, and the resource XmNlabelString
|
||||
will be used as the label.
|
||||
|
||||
XmNvisibleItemCount:
|
||||
This resource is passed on to the XmListWidget as the
|
||||
XmNvisibleItemCount resource.
|
||||
See also XmListWidget.
|
||||
|
||||
|
||||
========================================================================
|
||||
|
||||
Functions available for ComboBox widget.
|
||||
|
||||
Widget
|
||||
DtCreateComboBox(parent, name, args, num_args)
|
||||
Widget parent;
|
||||
char *name;
|
||||
ArgList args;
|
||||
int num_args;
|
||||
{
|
||||
}
|
||||
|
||||
Creates an instance of a ComboBox widget.
|
||||
|
||||
|
||||
void
|
||||
DtComboBoxAddItem(widget, item, position, unique)
|
||||
DtComboBoxWidget widget;
|
||||
XmString item;
|
||||
int position;
|
||||
Boolean unique;
|
||||
|
||||
Adds the given item to the list at the given position.
|
||||
position is an integer specifying the position of the new item in the
|
||||
list. A value of 1 makes the new item the first item in the list; a value
|
||||
of 2 makes it the second item, and so on. A value of 0 (zero) makes the new
|
||||
item the last item in the list.
|
||||
If the unique parameter is TRUE, the item will only be added if it doesn't
|
||||
already exist. If it is FALSE, the item will always be added.
|
||||
See also, XmListSelectItem in the Motif reference manual.
|
||||
|
||||
|
||||
void
|
||||
DtComboBoxDeletePos(widget, position)
|
||||
DtComboBoxWidget widget;
|
||||
int position;
|
||||
|
||||
Deletes the item at the given position from the list.
|
||||
position is an integer specifying the position of the item to delete
|
||||
in the list. A value of 1 indicates that the first item in the list is
|
||||
to be deleted. A value of 2 indicates the second item, etc. A value of 0
|
||||
indicates that the last item is to be deleted. See also,
|
||||
XmListSelectItem in the Motif reference manual.
|
||||
|
||||
void
|
||||
DtComboBoxSetItem(widget, item)
|
||||
DtComboBoxWidget widget;
|
||||
XmString item;
|
||||
|
||||
Puts the given item into the combo-box label or text-field (this will be the
|
||||
new value shown). The given item will be positioned at the top of the
|
||||
list. This may cause problems if the viewing area is larger than the
|
||||
number of items in the list. The new item will not be selected (use
|
||||
DtComboBoxSelectItem).
|
||||
See also, XmListSetItem in the Motif reference manual.
|
||||
|
||||
|
||||
void
|
||||
DtComboBoxSelectItem(combo, item)
|
||||
DtComboBoxWidget combo;
|
||||
XmString item;
|
||||
|
||||
Puts the given item into the combo-box label or text-field (this will be the
|
||||
new value shown). The currently selected item in the list will be deselected
|
||||
and the given item will be selected. See also, XmListSelectItem in the Motif
|
||||
reference manual.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
2630
mozilla/cmd/xfe/DtWidgets/ComboBox.c
Normal file
2630
mozilla/cmd/xfe/DtWidgets/ComboBox.c
Normal file
File diff suppressed because it is too large
Load Diff
153
mozilla/cmd/xfe/DtWidgets/ComboBox.h
Normal file
153
mozilla/cmd/xfe/DtWidgets/ComboBox.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* ComboBox.h, Interleaf, 16aug93 2:37pm Version 1.1.
|
||||
*/
|
||||
|
||||
/***********************************************************
|
||||
Copyright 1993 Interleaf, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose without fee is granted,
|
||||
provided that the above copyright notice appear in all copies
|
||||
and that both copyright notice and this permission notice appear
|
||||
in supporting documentation, and that the name of Interleaf not
|
||||
be used in advertising or publicly pertaining to distribution of
|
||||
the software without specific written prior permission.
|
||||
|
||||
Interleaf makes no representation about the suitability of this
|
||||
software for any purpose. It is provided "AS IS" without any
|
||||
express or implied warranty.
|
||||
******************************************************************/
|
||||
|
||||
/*
|
||||
* (C) Copyright 1991,1992, 1993
|
||||
* Interleaf, Inc.
|
||||
* Nine Hillside Avenue, Waltham, MA 02154
|
||||
*
|
||||
* ComboBox.h:
|
||||
*
|
||||
* Public header file for DtComboBoxWidget.
|
||||
*/
|
||||
#ifndef _ComboBox_h
|
||||
#define _ComboBox_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef AA
|
||||
#define AA(args) ()
|
||||
#endif
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
|
||||
#ifndef XmNarrowSize
|
||||
#define XmNarrowSize "arrowSize"
|
||||
#endif
|
||||
#ifndef XmNarrowSpacing
|
||||
#define XmNarrowSpacing "arrowSpacing"
|
||||
#endif
|
||||
#define XmNarrowType "arrowType"
|
||||
#ifndef XmNlist
|
||||
#define XmNlist "list"
|
||||
#endif
|
||||
#define XmNlistFontList "listFontList"
|
||||
#define XmNpoppedUp "poppedUp"
|
||||
#ifndef XmNselectedPosition
|
||||
#define XmNselectedPosition "selectedPosition"
|
||||
#endif
|
||||
#ifndef XmNselectedItem
|
||||
#define XmNselectedItem "selectedItem"
|
||||
#endif
|
||||
#ifndef XmNtextField
|
||||
#define XmNtextField "textField"
|
||||
#endif
|
||||
#define XmNtype "type"
|
||||
#define XmNupdateLabel "updateLabel"
|
||||
#define XmNmoveSelectedItemUp "moveSelectedItemUp"
|
||||
#define XmNnoCallbackForArrow "noCallbackForArrow"
|
||||
|
||||
#ifndef XmCArrowSize
|
||||
#define XmCArrowSize "ArrowSize"
|
||||
#endif
|
||||
#ifndef XmCArrowSpacing
|
||||
#define XmCArrowSpacing "ArrowSpacing"
|
||||
#endif
|
||||
#define XmCArrowType "ArrowType"
|
||||
#define XmCHorizontalSpacing "HorizontalSpacing"
|
||||
#ifndef XmCList
|
||||
#define XmCList "List"
|
||||
#endif
|
||||
#define XmCListFontList "ListFontList"
|
||||
#define XmCPoppedUp "PoppedUp"
|
||||
#ifndef XmCSelectedPosition
|
||||
#define XmCSelectedPosition "SelectedPosition"
|
||||
#endif
|
||||
#ifndef XmCSelectedItem
|
||||
#define XmCSelectedItem "SelectedItem"
|
||||
#endif
|
||||
#define XmCType "Type"
|
||||
#ifndef XmCTextField
|
||||
#define XmCTextField "TextField"
|
||||
#endif
|
||||
#define XmCUpdateLabel "UpdateLabel"
|
||||
#define XmCVerticalSpacing "VerticalSpacing"
|
||||
#define XmCMoveSelectedItemUp "MoveSelectedItemUp"
|
||||
#define XmCNoCallbackForArrow "NoCallbackForArrow"
|
||||
|
||||
#define XmRArrowType "ArrowType"
|
||||
#define XmRType "Type"
|
||||
|
||||
/* XmNorientation defines */
|
||||
#define XmLEFT 0
|
||||
#define XmRIGHT 1
|
||||
|
||||
/* ArrowType defines */
|
||||
#define XmMOTIF 0
|
||||
#define XmWINDOWS 1
|
||||
|
||||
/* XmNtype defines */
|
||||
#define XmDROP_DOWN_LIST_BOX 0
|
||||
#define XmDROP_DOWN_COMBO_BOX 1
|
||||
|
||||
/* ComboBox callback info */
|
||||
#ifndef XmNselectionCallback
|
||||
#define XmNselectionCallback "selectionCallback"
|
||||
#endif
|
||||
#define XmNmenuPostCallback "menuPostCallback"
|
||||
#define XmCR_SELECT 128 /* Large #, so no collisions with XM */
|
||||
#define XmCR_MENU_POST 129 /* Large #, so no collisions with XM */
|
||||
|
||||
typedef struct {
|
||||
int reason;
|
||||
XEvent *event;
|
||||
XmString item_or_text;
|
||||
int item_position;
|
||||
} DtComboBoxCallbackStruct;
|
||||
|
||||
extern WidgetClass dtComboBoxWidgetClass;
|
||||
|
||||
typedef struct _DtComboBoxClassRec *DtComboBoxWidgetClass;
|
||||
typedef struct _DtComboBoxRec *DtComboBoxWidget;
|
||||
|
||||
/*
|
||||
* External functions which manipulate the ComboBox list of items.
|
||||
*/
|
||||
extern Widget DtCreateComboBox (Widget parent, char *name,
|
||||
Arg *arglist, int num_args);
|
||||
extern void DtComboBoxAddItem (Widget combo, XmString item,
|
||||
int pos, Boolean unique);
|
||||
extern void DtComboBoxDeletePos (Widget combo, int pos);
|
||||
extern void DtComboBoxDeleteAllItems(Widget combo);
|
||||
extern void DtComboBoxSetItem (Widget combo, XmString item);
|
||||
extern void DtComboBoxSelectItem (Widget combo, XmString item);
|
||||
|
||||
/* xfe additions */
|
||||
extern void DtComboBoxAddItemSelected (Widget combo, XmString item, int pos, Boolean unique);
|
||||
extern void DtComboBoxDeleteAllItems (Widget combo);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _ComboBox_h */
|
||||
186
mozilla/cmd/xfe/DtWidgets/ComboBoxP.h
Normal file
186
mozilla/cmd/xfe/DtWidgets/ComboBoxP.h
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* ComboBoxP.h, Interleaf, 16aug93 2:37pm Version 1.1.
|
||||
*/
|
||||
/***********************************************************
|
||||
Copyright 1993 Interleaf, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose without fee is granted,
|
||||
provided that the above copyright notice appear in all copies
|
||||
and that both copyright notice and this permission notice appear
|
||||
in supporting documentation, and that the name of Interleaf not
|
||||
be used in advertising or publicly pertaining to distribution of
|
||||
the software without specific written prior permission.
|
||||
|
||||
Interleaf makes no representation about the suitability of this
|
||||
software for any purpose. It is provided "AS IS" without any
|
||||
express or implied warranty.
|
||||
******************************************************************/
|
||||
|
||||
/*
|
||||
* (C) Copyright 1991,1992, 1993
|
||||
* Interleaf, Inc.
|
||||
* Nine Hillside Avenue, Waltham, MA 02154
|
||||
*
|
||||
* ComboBoxP.h:
|
||||
*
|
||||
* Private header file for DtComboBoxWidget.
|
||||
*/
|
||||
#ifndef _ComboBoxP_h
|
||||
#define _ComboBoxP_h
|
||||
|
||||
#ifndef AA
|
||||
#define AA(args) ()
|
||||
#endif
|
||||
|
||||
#include <X11/IntrinsicP.h>
|
||||
#include <X11/ShellP.h>
|
||||
#include <Xm/DrawnB.h>
|
||||
#include <Xm/ArrowB.h>
|
||||
#include <Xm/TextFP.h>
|
||||
#include <Xm/Label.h>
|
||||
#include <Xm/Frame.h>
|
||||
#include <Xm/ListP.h>
|
||||
#include <Xm/Separator.h>
|
||||
#include <Xm/ScrolledWP.h>
|
||||
#include <Xm/ScrollBarP.h>
|
||||
|
||||
#include <Xm/ManagerP.h>
|
||||
#include "ComboBox.h"
|
||||
|
||||
/*
|
||||
* External definitions of syn_resources for our list widget.
|
||||
*/
|
||||
#define SYN_RESOURCE_AA AA((Widget w, int resource_offset, XtArgVal *value))
|
||||
extern void _DtComboBoxGetArrowSize SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetLabelString SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListItemCount SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListItems SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListFontList SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListMarginHeight SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListMarginWidth SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListSpacing SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListTopItemPosition SYN_RESOURCE_AA;
|
||||
extern void _DtComboBoxGetListVisibleItemCount SYN_RESOURCE_AA;
|
||||
|
||||
#define ARROW_MULT .45
|
||||
#define ARROW_MIN 13
|
||||
#define MARGIN 2
|
||||
#define LABEL_PADDING 2
|
||||
#define LABEL_SHADOW 2
|
||||
#define TEXT_FIELD_SHADOW 1
|
||||
|
||||
/*
|
||||
* Class Records
|
||||
*/
|
||||
typedef struct {
|
||||
Boolean junk; /* Need something */
|
||||
} DtComboBoxClassPart;
|
||||
|
||||
typedef struct _DtComboBoxClassRec {
|
||||
CoreClassPart core_class;
|
||||
CompositeClassPart composite_class;
|
||||
ConstraintClassPart constraint_class;
|
||||
XmManagerClassPart manager_class;
|
||||
DtComboBoxClassPart combo_box_class;
|
||||
} DtComboBoxClassRec;
|
||||
|
||||
extern DtComboBoxClassRec dtComboBoxClassRec;
|
||||
|
||||
|
||||
/*
|
||||
* Instance Record.
|
||||
*/
|
||||
typedef struct _DtComboBoxPart {
|
||||
/* Private data */
|
||||
Widget arrow;
|
||||
Widget shell;
|
||||
Widget frame;
|
||||
Widget label;
|
||||
Widget sep;
|
||||
Dimension old_width;
|
||||
Dimension old_height;
|
||||
Dimension label_max_length;
|
||||
Dimension label_max_height;
|
||||
/*
|
||||
* max_shell_width is the width that is needed to hold the
|
||||
* list if the longest item was visible. We then use this
|
||||
* width to figure out if the shell is not wide enough,
|
||||
* when it gets popped on the screen. This is needed in case the
|
||||
* combo-box resizes, or if items changes (list will resize).
|
||||
* Sometimes we change the size of the shell to fit on the screen, or
|
||||
* to make it at least as large as the combo_box. The next time we pop
|
||||
* the shell up the size may be different; therefore, we set the shell
|
||||
* size to the maximum everytime it gets popped up, then we will
|
||||
* make adjustments, only if needed.
|
||||
* This value gets saved every time the user updates XmNitems.
|
||||
*/
|
||||
Dimension max_shell_width;
|
||||
Dimension max_shell_height;
|
||||
|
||||
/* ComboBox specific resources */
|
||||
XtCallbackList activate_callback;
|
||||
unsigned char alignment;
|
||||
Dimension arrow_size;
|
||||
Dimension arrow_spacing;
|
||||
unsigned char arrow_type;
|
||||
short text_columns;
|
||||
XtCallbackList focus_callback;
|
||||
Dimension horizontal_spacing;
|
||||
int item_count;
|
||||
XmStringTable items;
|
||||
XmString label_string;
|
||||
Widget list;
|
||||
XmFontList list_font_list;
|
||||
Dimension list_margin_height;
|
||||
Dimension list_margin_width;
|
||||
Dimension list_spacing;
|
||||
XtCallbackList losing_focus_callback;
|
||||
Dimension margin_height;
|
||||
Dimension margin_width;
|
||||
unsigned int text_max_length;
|
||||
XtCallbackList menu_post_callback;
|
||||
unsigned char orientation;
|
||||
Boolean popped_up;
|
||||
Boolean recompute_size;
|
||||
XmString selected_item;
|
||||
int selected_position;
|
||||
XtCallbackList selection_callback;
|
||||
Widget text;
|
||||
int top_item_position;
|
||||
unsigned char type;
|
||||
Boolean update_label;
|
||||
Dimension vertical_spacing;
|
||||
int visible_item_count;
|
||||
Boolean move_selecteditem_up;
|
||||
Boolean no_callback_for_arrow;
|
||||
} DtComboBoxPart;
|
||||
|
||||
|
||||
typedef struct _DtComboBoxRec {
|
||||
CorePart core;
|
||||
CompositePart composite;
|
||||
ConstraintPart constraint;
|
||||
XmManagerPart manager;
|
||||
DtComboBoxPart combo_box;
|
||||
} DtComboBoxRec;
|
||||
|
||||
|
||||
/*
|
||||
* Error defines.
|
||||
*/
|
||||
#define COMBO_ALIGNMENT "DtComboButtonWidget: Invalid alignment resource (defaulting to XmALIGNMENT_CENTER)."
|
||||
#define COMBO_MARGIN_HEIGHT "DtComboButtonWidget: Invalid marginHeight resource (defaulting to 2)."
|
||||
#define COMBO_MARGIN_WIDTH "DtComboButtonWidget: Invalid marginHeight resource (defaulting to 2)."
|
||||
#define COMBO_HORIZONTAL_SPACING "DtComboButtonWidget: Invalid horizontalSpacing resource (defaulting to 0)."
|
||||
#define COMBO_VERTICAL_SPACING "DtComboButtonWidget: Invalid verticalSpacing resource (defaulting to 0)."
|
||||
#define COMBO_ORIENTATION "DtComboButtonWidget: Invalid orientation resource (defaulting to XmRIGHT)."
|
||||
#define COMBO_ITEM_COUNT "DtComboButtonWidget: Invalid itemCount resource (defaulting to 0)."
|
||||
#define COMBO_VISIBLE_ITEM "DtComboButtonWidget: Invalid selectedPosition resource (defaulting to 0)."
|
||||
#define COMBO_TEXT "DtComboButtonWidget: Unable to set textField resource."
|
||||
#define COMBO_ITEM_COUNT "DtComboButtonWidget: Invalid itemCount resource (defaulting to 0)."
|
||||
#define COMBO_SET_ITEM "DtComboBoxWidget: Unable to find item to set (DtComboBoxSetItem)."
|
||||
#define COMBO_SELECT_ITEM "DtComboBoxWidget: Unable to find item to select (XmComboBoxSelectItem)."
|
||||
|
||||
|
||||
#endif /* _XmComboBoxP_h */
|
||||
25
mozilla/cmd/xfe/DtWidgets/Makefile
Normal file
25
mozilla/cmd/xfe/DtWidgets/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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 = ../../..
|
||||
|
||||
MODULE = DtWidgets
|
||||
LIBRARY_NAME = DtWidgets
|
||||
|
||||
CSRCS = ComboBox.c
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
30
mozilla/cmd/xfe/DtWidgets/Makefile.in
Normal file
30
mozilla/cmd/xfe/DtWidgets/Makefile.in
Normal file
@@ -0,0 +1,30 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = DtWidgets
|
||||
LIBRARY_NAME = DtWidgets
|
||||
|
||||
CSRCS = ComboBox.c
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
1339
mozilla/cmd/xfe/Makefile
Normal file
1339
mozilla/cmd/xfe/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
1358
mozilla/cmd/xfe/Makefile.in
Normal file
1358
mozilla/cmd/xfe/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
31
mozilla/cmd/xfe/Microline3.0/Makefile
Normal file
31
mozilla/cmd/xfe/Microline3.0/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
#
|
||||
# The following source code is part of the Microline Widget Library.
|
||||
# The Microline widget library is made available to Mozilla developers
|
||||
# under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
# more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
# http://www.neurondata.com.
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
DIRS = XmL
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
36
mozilla/cmd/xfe/Microline3.0/Makefile.in
Normal file
36
mozilla/cmd/xfe/Microline3.0/Makefile.in
Normal file
@@ -0,0 +1,36 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
#
|
||||
# The following source code is part of the Microline Widget Library.
|
||||
# The Microline widget library is made available to Mozilla developers
|
||||
# under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
# more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
# http://www.neurondata.com.
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = XmL
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
3700
mozilla/cmd/xfe/Microline3.0/XmL/Folder.c
Normal file
3700
mozilla/cmd/xfe/Microline3.0/XmL/Folder.c
Normal file
File diff suppressed because it is too large
Load Diff
57
mozilla/cmd/xfe/Microline3.0/XmL/Folder.h
Normal file
57
mozilla/cmd/xfe/Microline3.0/XmL/Folder.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLFolderH
|
||||
#define XmLFolderH
|
||||
|
||||
#include <XmL/XmL.h>
|
||||
|
||||
#ifdef XmL_CPP
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern WidgetClass xmlFolderWidgetClass;
|
||||
typedef struct _XmLFolderClassRec *XmLFolderWidgetClass;
|
||||
typedef struct _XmLFolderRec *XmLFolderWidget;
|
||||
|
||||
#define XmLIsFolder(w) XtIsSubclass((w), xmlFolderWidgetClass)
|
||||
|
||||
Widget XmLCreateFolder(Widget parent, char *name, ArgList arglist,
|
||||
Cardinal argcount);
|
||||
Widget XmLFolderAddBitmapTab(Widget w, XmString string,
|
||||
char *bitmapBits, int bitmapWidth, int bitmapHeight);
|
||||
Widget XmLFolderAddBitmapTabForm(Widget w, XmString string,
|
||||
char *bitmapBits, int bitmapWidth, int bitmapHeight);
|
||||
Widget XmLFolderAddTab(Widget w, XmString string);
|
||||
Widget XmLFolderAddTabFromClass(Widget w, XmString string);
|
||||
Widget XmLFolderAddTabForm(Widget w, XmString string);
|
||||
void XmLFolderSetActiveTab(Widget w, int position, Boolean notify);
|
||||
|
||||
#ifdef XmL_CPP
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
113
mozilla/cmd/xfe/Microline3.0/XmL/FolderP.h
Normal file
113
mozilla/cmd/xfe/Microline3.0/XmL/FolderP.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLFolderPH
|
||||
#define XmLFolderPH
|
||||
|
||||
#include <Xm/XmP.h>
|
||||
|
||||
#ifdef MOTIF11
|
||||
#else
|
||||
#include <Xm/ManagerP.h>
|
||||
#endif
|
||||
|
||||
#include "Folder.h"
|
||||
|
||||
typedef struct _XmLFolderPart
|
||||
{
|
||||
int debugLevel;
|
||||
Boolean serverDrawsArcsLarge;
|
||||
unsigned char cornerStyle, tabPlacement, resizePolicy;
|
||||
Boolean allowRotate, autoSelect;
|
||||
GC gc;
|
||||
Pixel inactiveBg, inactiveFg, blankBg;
|
||||
Pixmap blankPix;
|
||||
WidgetList tabs;
|
||||
int tabCount, tabAllocCount;
|
||||
Dimension marginWidth, marginHeight, spacing;
|
||||
Dimension cornerDimension, highlightThickness;
|
||||
Dimension pixmapMargin;
|
||||
Dimension tabHeight, tabWidth, tabBarHeight;
|
||||
int tabsPerRow, activeRow;
|
||||
XtTranslations primTrans;
|
||||
Widget focusW, activeW;
|
||||
int activeTab;
|
||||
char allowLayout;
|
||||
XtCallbackList activateCallback;
|
||||
XmFontList fontList;
|
||||
|
||||
WidgetClass tabWidgetClass;
|
||||
|
||||
} XmLFolderPart;
|
||||
|
||||
typedef struct _XmLFolderRec
|
||||
{
|
||||
CorePart core;
|
||||
CompositePart composite;
|
||||
ConstraintPart constraint;
|
||||
XmManagerPart manager;
|
||||
XmLFolderPart folder;
|
||||
} XmLFolderRec;
|
||||
|
||||
typedef struct _XmLFolderClassPart
|
||||
{
|
||||
int unused;
|
||||
} XmLFolderClassPart;
|
||||
|
||||
typedef struct _XmLFolderClassRec
|
||||
{
|
||||
CoreClassPart core_class;
|
||||
CompositeClassPart composite_class;
|
||||
ConstraintClassPart constraint_class;
|
||||
XmManagerClassPart manager_class;
|
||||
XmLFolderClassPart folder_class;
|
||||
} XmLFolderClassRec;
|
||||
|
||||
extern XmLFolderClassRec xmlFolderClassRec;
|
||||
|
||||
typedef struct _XmLFolderConstraintPart
|
||||
{
|
||||
Position x, y;
|
||||
Dimension width, height;
|
||||
Dimension maxPixWidth, maxPixHeight;
|
||||
Dimension pixWidth, pixHeight;
|
||||
Dimension inactPixWidth, inactPixHeight;
|
||||
int row;
|
||||
Boolean firstInRow;
|
||||
Boolean freePix;
|
||||
Pixmap pix, inactPix;
|
||||
char *managedName;
|
||||
Widget managedW;
|
||||
} XmLFolderConstraintPart;
|
||||
|
||||
typedef struct _XmLFolderConstraintRec
|
||||
{
|
||||
XmManagerConstraintPart manager;
|
||||
XmLFolderConstraintPart folder;
|
||||
} XmLFolderConstraintRec, *XmLFolderConstraintPtr;
|
||||
|
||||
#endif
|
||||
11385
mozilla/cmd/xfe/Microline3.0/XmL/Grid.c
Normal file
11385
mozilla/cmd/xfe/Microline3.0/XmL/Grid.c
Normal file
File diff suppressed because it is too large
Load Diff
147
mozilla/cmd/xfe/Microline3.0/XmL/Grid.h
Normal file
147
mozilla/cmd/xfe/Microline3.0/XmL/Grid.h
Normal file
@@ -0,0 +1,147 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLGridH
|
||||
#define XmLGridH
|
||||
|
||||
#include <XmL/XmL.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef XmL_CPP
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern WidgetClass xmlGridWidgetClass;
|
||||
typedef struct _XmLGridClassRec *XmLGridWidgetClass;
|
||||
typedef struct _XmLGridRec *XmLGridWidget;
|
||||
typedef struct _XmLGridRowRec *XmLGridRow;
|
||||
typedef struct _XmLGridColumnRec *XmLGridColumn;
|
||||
typedef struct _XmLGridCellRec *XmLGridCell;
|
||||
|
||||
#define XmLIsGrid(w) XtIsSubclass((w), xmlGridWidgetClass)
|
||||
|
||||
Widget XmLCreateGrid(Widget parent, char *name, ArgList arglist,
|
||||
Cardinal argcount);
|
||||
void XmLGridAddColumns(Widget w, unsigned char type, int position, int count);
|
||||
void XmLGridAddRows(Widget w, unsigned char type, int position, int count);
|
||||
Boolean XmLGridColumnIsVisible(Widget w, int column);
|
||||
Boolean XmLGridCopyPos(Widget w, Time time, unsigned char rowType, int row,
|
||||
unsigned char columnType, int column, int nrow, int ncolumn);
|
||||
Boolean XmLGridCopySelected(Widget w, Time time);
|
||||
void XmLGridDeleteAllColumns(Widget w, unsigned char type);
|
||||
void XmLGridDeleteAllRows(Widget w, unsigned char type);
|
||||
void XmLGridDeleteColumns(Widget w, unsigned char type, int position,
|
||||
int count);
|
||||
void XmLGridDeleteRows(Widget w, unsigned char type, int position, int count);
|
||||
void XmLGridDeselectAllCells(Widget w, Boolean notify);
|
||||
void XmLGridDeselectAllColumns(Widget w, Boolean notify);
|
||||
void XmLGridDeselectAllRows(Widget w, Boolean notify);
|
||||
void XmLGridDeselectCell(Widget w, int row, int column, Boolean notify);
|
||||
void XmLGridDeselectColumn(Widget w, int column, Boolean notify);
|
||||
void XmLGridDeselectRow(Widget w, int row, Boolean notify);
|
||||
int XmLGridEditBegin(Widget w, Boolean insert, int row, int column);
|
||||
void XmLGridEditCancel(Widget w);
|
||||
void XmLGridEditComplete(Widget w);
|
||||
XmLGridColumn XmLGridGetColumn(Widget w, unsigned char columnType, int column);
|
||||
void XmLGridGetFocus(Widget w, int *row, int *column, Boolean *focusIn);
|
||||
XmLGridRow XmLGridGetRow(Widget w, unsigned char rowType, int row);
|
||||
int XmLGridGetSelectedCellCount(Widget w);
|
||||
int XmLGridGetSelectedCells(Widget w, int *rowPositions,
|
||||
int *columnPositions, int count);
|
||||
int XmLGridGetSelectedColumnCount(Widget w);
|
||||
int XmLGridGetSelectedColumns(Widget w, int *positions, int count);
|
||||
int XmLGridGetSelectedRow(Widget w);
|
||||
int XmLGridGetSelectedRowCount(Widget w);
|
||||
int XmLGridGetSelectedRows(Widget w, int *positions, int count);
|
||||
void XmLGridMoveColumns(Widget w, int newPosition, int position, int count);
|
||||
void XmLGridMoveRows(Widget w, int newPosition, int position, int count);
|
||||
Boolean XmLGridPaste(Widget w);
|
||||
Boolean XmLGridPastePos(Widget w, unsigned char rowType, int row,
|
||||
unsigned char columnType, int column);
|
||||
int XmLGridRead(Widget w, FILE *file, int format, char delimiter);
|
||||
int XmLGridReadPos(Widget w, FILE *file, int format, char delimiter,
|
||||
unsigned char rowType, int row, unsigned char columnType, int column);
|
||||
void XmLGridRedrawAll(Widget w);
|
||||
void XmLGridRedrawCell(Widget w, unsigned char rowType, int row,
|
||||
unsigned char columnType, int column);
|
||||
void XmLGridRedrawColumn(Widget w, unsigned char type, int column);
|
||||
void XmLGridRedrawRow(Widget w, unsigned char type, int row);
|
||||
void XmLGridReorderColumns(Widget w, int *newPositions,
|
||||
int position, int count);
|
||||
void XmLGridReorderRows(Widget w, int *newPositions,
|
||||
int position, int count);
|
||||
int XmLGridRowColumnToXY(Widget w, unsigned char rowType, int row,
|
||||
unsigned char columnType, int column, Boolean clipped, XRectangle *rect);
|
||||
Boolean XmLGridRowIsVisible(Widget w, int row);
|
||||
void XmLGridSelectAllCells(Widget w, Boolean notify);
|
||||
void XmLGridSelectAllColumns(Widget w, Boolean notify);
|
||||
void XmLGridSelectAllRows(Widget w, Boolean notify);
|
||||
void XmLGridSelectCell(Widget w, int row, int column, Boolean notify);
|
||||
void XmLGridSelectColumn(Widget w, int column, Boolean notify);
|
||||
void XmLGridSelectRow(Widget w, int row, Boolean notify);
|
||||
int XmLGridSetFocus(Widget w, int row, int column);
|
||||
int XmLGridSetStrings(Widget w, char *data);
|
||||
int XmLGridSetStringsPos(Widget w, unsigned char rowType, int row,
|
||||
unsigned char columnType, int column, char *data);
|
||||
int XmLGridWrite(Widget w, FILE *file, int format, char delimiter,
|
||||
Boolean skipHidden);
|
||||
int XmLGridWritePos(Widget w, FILE *file, int format, char delimiter,
|
||||
Boolean skipHidden, unsigned char rowType, int row,
|
||||
unsigned char columnType, int column, int nrow, int ncolumn);
|
||||
int XmLGridXYToRowColumn(Widget w, int x, int y, unsigned char *rowType,
|
||||
int *row, unsigned char *columnType, int *column);
|
||||
|
||||
int XmLGridPosIsResize(Widget g, int x, int y);
|
||||
|
||||
void XmLGridSetVisibleColumnCount(Widget w, int num_visible);
|
||||
void XmLGridHideRightColumn(Widget w);
|
||||
void XmLGridUnhideRightColumn(Widget w);
|
||||
|
||||
int XmLGridGetRowCount(Widget w);
|
||||
int XmLGridGetColumnCount(Widget w);
|
||||
|
||||
/* extern */ void
|
||||
XmLGridXYToCellTracking(Widget widget,
|
||||
int x, /* input only args. */
|
||||
int y, /* input only args. */
|
||||
Boolean * m_inGrid, /* input/output args. */
|
||||
int * m_lastRow, /* input/output args. */
|
||||
int * m_lastCol, /* input/output args. */
|
||||
unsigned char * m_lastRowtype,/* input/output args. */
|
||||
unsigned char * m_lastColtype,/* input/output args. */
|
||||
int * outRow, /* output only args. */
|
||||
int * outCol, /* output only args. */
|
||||
Boolean * enter, /* output only args. */
|
||||
Boolean * leave); /* output only args. */
|
||||
|
||||
void XmLGridGetSort(Widget w, int *column, unsigned char *sortType);
|
||||
void XmLGridSetSort(Widget w, int column, unsigned char sortType);
|
||||
|
||||
#ifdef XmL_CPP
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
475
mozilla/cmd/xfe/Microline3.0/XmL/GridP.h
Normal file
475
mozilla/cmd/xfe/Microline3.0/XmL/GridP.h
Normal file
@@ -0,0 +1,475 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLGridPH
|
||||
#define XmLGridPH
|
||||
|
||||
#include <Xm/XmP.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef MOTIF11
|
||||
#include <Xm/ManagerP.h>
|
||||
#include <Xm/DrawP.h>
|
||||
#include <Xm/DragC.h>
|
||||
#include <Xm/DropTrans.h>
|
||||
#endif
|
||||
|
||||
#include "Grid.h"
|
||||
|
||||
#ifdef XmL_ANSIC
|
||||
|
||||
void _XmLGridLayout(XmLGridWidget g);
|
||||
|
||||
void _XmLGridCellDrawBackground(XmLGridCell cell, Widget w,
|
||||
XRectangle *clipRect, XmLGridDrawStruct *ds);
|
||||
void _XmLGridCellDrawBorders(XmLGridCell cell, Widget w,
|
||||
XRectangle *clipRect, XmLGridDrawStruct *ds);
|
||||
void _XmLGridCellDrawValue(XmLGridCell cell, Widget w,
|
||||
XRectangle *clipRect, XmLGridDrawStruct *ds);
|
||||
typedef int (*XmLGridPreLayoutProc)(XmLGridWidget g, int isVert);
|
||||
|
||||
typedef XmLGridRow (*XmLGridRowNewProc)(Widget grid);
|
||||
typedef void (*XmLGridRowFreeProc)(XmLGridRow);
|
||||
typedef void (*XmLGridGetRowValueMaskProc)(XmLGridWidget g,
|
||||
char *s, long *mask);
|
||||
typedef void (*XmLGridGetRowValueProc)(XmLGridWidget g, XmLGridRow row,
|
||||
XtArgVal value, long mask);
|
||||
typedef int (*XmLGridSetRowValuesProc)(XmLGridWidget g,
|
||||
XmLGridRow row, long mask);
|
||||
|
||||
typedef XmLGridColumn (*XmLGridColumnNewProc)(Widget grid);
|
||||
typedef void (*XmLGridColumnFreeProc)(XmLGridColumn);
|
||||
typedef void (*XmLGridGetColumnValueMaskProc)(XmLGridWidget g,
|
||||
char *s, long *mask);
|
||||
typedef void (*XmLGridGetColumnValueProc)(XmLGridWidget g, XmLGridColumn col,
|
||||
XtArgVal value, long mask);
|
||||
typedef int (*XmLGridSetColumnValuesProc)(XmLGridWidget g,
|
||||
XmLGridColumn col, long mask);
|
||||
|
||||
typedef int (*XmLGridSetCellValuesResizeProc)(XmLGridWidget g,
|
||||
XmLGridRow row, XmLGridColumn col, XmLGridCell cell, long mask);
|
||||
typedef int (*XmLGridCellActionProc)(XmLGridCell, Widget,
|
||||
XmLGridCallbackStruct *);
|
||||
|
||||
#else
|
||||
|
||||
void _XmLGridLayout();
|
||||
|
||||
void _XmLGridCellDrawBackground();
|
||||
void _XmLGridCellDrawBorders();
|
||||
void _XmLGridCellDrawValue();
|
||||
typedef int (*XmLGridPreLayoutProc)();
|
||||
|
||||
typedef XmLGridRow (*XmLGridRowNewProc)();
|
||||
typedef void (*XmLGridRowFreeProc)() ;
|
||||
typedef void (*XmLGridGetRowValueMaskProc)();
|
||||
typedef void (*XmLGridGetRowValueProc)();
|
||||
typedef int (*XmLGridSetRowValuesProc)();
|
||||
|
||||
typedef XmLGridColumn (*XmLGridColumnNewProc)() ;
|
||||
typedef void (*XmLGridColumnFreeProc)() ;
|
||||
typedef void (*XmLGridGetColumnValueMaskProc)();
|
||||
typedef void (*XmLGridGetColumnValueProc)();
|
||||
typedef int (*XmLGridSetColumnValuesProc)();
|
||||
|
||||
typedef int (*XmLGridSetCellValuesResizeProc)();
|
||||
typedef int (*XmLGridCellActionProc)();
|
||||
|
||||
#endif
|
||||
|
||||
#define XmLGridClassPartOfWidget(w) \
|
||||
((XmLGridWidgetClass)XtClass(w))->grid_class
|
||||
|
||||
#define XmInheritGridPreLayout ((XmLGridPreLayoutProc)_XtInherit)
|
||||
|
||||
#define XmInheritGridRowNew ((XmLGridRowNewProc)_XtInherit)
|
||||
#define XmInheritGridRowFree ((XmLGridRowFreeProc)_XtInherit)
|
||||
#define XmInheritGridGetRowValueMask ((XmLGridGetRowValueMaskProc)_XtInherit)
|
||||
#define XmInheritGridGetRowValue ((XmLGridGetRowValueProc)_XtInherit)
|
||||
#define XmInheritGridSetRowValues ((XmLGridSetRowValuesProc)_XtInherit)
|
||||
|
||||
#define XmInheritGridColumnNew ((XmLGridColumnNewProc)_XtInherit)
|
||||
#define XmInheritGridColumnFree ((XmLGridColumnFreeProc)_XtInherit)
|
||||
#define XmInheritGridGetColumnValueMask \
|
||||
((XmLGridGetColumnValueMaskProc)_XtInherit)
|
||||
#define XmInheritGridGetColumnValue ((XmLGridGetColumnValueProc)_XtInherit)
|
||||
#define XmInheritGridSetColumnValues ((XmLGridSetColumnValuesProc)_XtInherit)
|
||||
|
||||
#define XmInheritGridSetCellValuesResize \
|
||||
((XmLGridSetCellValuesResizeProc)_XtInherit)
|
||||
#define XmInheritGridCellAction ((XmLGridCellActionProc)_XtInherit)
|
||||
|
||||
/* row value mask for get/set values */
|
||||
#define XmLGridRowHeight (1L<<0)
|
||||
#define XmLGridRowSizePolicy (1L<<1)
|
||||
#define XmLGridRowUserData (1L<<2)
|
||||
#define XmLGridRowValueMaskLen 3
|
||||
|
||||
/* column value mask for get/set values */
|
||||
#define XmLGridColumnWidth (1L<<0)
|
||||
#define XmLGridColumnSizePolicy (1L<<1)
|
||||
#define XmLGridColumnUserData (1L<<2)
|
||||
#define XmLGridColumnResizable (1L<<3)
|
||||
#define XmLGridColumnHidden (1L<<4)
|
||||
#define XmLGridColumnSortType (1L<<5)
|
||||
#define XmLGridColumnValueMaskLen 6
|
||||
|
||||
/* flags for XmLGridCell flags member */
|
||||
#define XmLGridCellSelectedFlag (1 << 0)
|
||||
#define XmLGridCellValueSetFlag (1 << 1)
|
||||
#define XmLGridCellInRowSpanFlag (1 << 2)
|
||||
#define XmLGridCellInColumnSpanFlag (1 << 3)
|
||||
#define XmLGridCellDrawSortFlag (1 << 4)
|
||||
#define XmLGridCellSortAscendingFlag (1 << 5)
|
||||
|
||||
/* cell value mask for get/set values */
|
||||
#define XmLGridCellAlignment (1L<<0)
|
||||
#define XmLGridCellBackground (1L<<1)
|
||||
#define XmLGridCellBottomBorderColor (1L<<2)
|
||||
#define XmLGridCellBottomBorderType (1L<<3)
|
||||
#define XmLGridCellColumnSpan (1L<<4)
|
||||
#define XmLGridCellEditable (1L<<5)
|
||||
#define XmLGridCellFontList (1L<<6)
|
||||
#define XmLGridCellForeground (1L<<7)
|
||||
#define XmLGridCellLeftBorderColor (1L<<8)
|
||||
#define XmLGridCellLeftBorderType (1L<<9)
|
||||
#define XmLGridCellMarginBottom (1L<<10)
|
||||
#define XmLGridCellMarginLeft (1L<<11)
|
||||
#define XmLGridCellMarginRight (1L<<12)
|
||||
#define XmLGridCellMarginTop (1L<<13)
|
||||
#define XmLGridCellPixmapF (1L<<14)
|
||||
#define XmLGridCellPixmapMask (1L<<15)
|
||||
#define XmLGridCellRightBorderColor (1L<<16)
|
||||
#define XmLGridCellRightBorderType (1L<<17)
|
||||
#define XmLGridCellRowSpan (1L<<18)
|
||||
#define XmLGridCellString (1L<<19)
|
||||
#define XmLGridCellToggleSet (1L<<20)
|
||||
#define XmLGridCellTopBorderColor (1L<<21)
|
||||
#define XmLGridCellTopBorderType (1L<<22)
|
||||
#define XmLGridCellType (1L<<23)
|
||||
#define XmLGridCellUserData (1L<<24)
|
||||
|
||||
/* This is now a resource */
|
||||
/* #define XmLICON_SPACING 4 */
|
||||
|
||||
enum { DrawAll, DrawHScroll, DrawVScroll, DrawRow, DrawCol, DrawCell };
|
||||
enum { SelectRow, SelectCol, SelectCell };
|
||||
enum { CursorNormal, CursorHResize, CursorVResize };
|
||||
enum { InNormal, InSelect, InResize, InMove };
|
||||
enum { DragLeft = 1, DragRight = 2, DragUp = 4, DragDown = 8 };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x, y, width, height;
|
||||
int row, col, nrow, ncol;
|
||||
} GridReg;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int row, col;
|
||||
} GridDropLoc;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char alignment;
|
||||
Pixel background;
|
||||
Pixel bottomBorderColor;
|
||||
char bottomBorderType;
|
||||
Dimension bottomMargin;
|
||||
int columnSpan;
|
||||
Boolean editable;
|
||||
short fontHeight;
|
||||
XmFontList fontList;
|
||||
short fontWidth;
|
||||
Pixel foreground;
|
||||
Pixel leftBorderColor;
|
||||
char leftBorderType;
|
||||
Dimension leftMargin;
|
||||
int refCount;
|
||||
Pixel rightBorderColor;
|
||||
char rightBorderType;
|
||||
Dimension rightMargin;
|
||||
int rowSpan;
|
||||
Pixel topBorderColor;
|
||||
char topBorderType;
|
||||
Dimension topMargin;
|
||||
unsigned char type;
|
||||
void *userData;
|
||||
} XmLGridCellRefValues;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Pixmap pixmap, pixmask;
|
||||
Dimension width, height;
|
||||
} XmLGridCellPixmap;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XmString string;
|
||||
XmLGridCellPixmap pix;
|
||||
} XmLGridCellIcon;
|
||||
|
||||
typedef struct _XmLGridCellPart
|
||||
{
|
||||
XmLGridCellRefValues *refValues;
|
||||
unsigned char flags;
|
||||
void *value;
|
||||
} XmLGridCellPart;
|
||||
|
||||
struct _XmLGridCellRec
|
||||
{
|
||||
XmLGridCellPart cell;
|
||||
};
|
||||
|
||||
typedef struct _XmLGridRowPart
|
||||
{
|
||||
int pos; /* required first for Array autonumber */
|
||||
Dimension height;
|
||||
unsigned char sizePolicy;
|
||||
Boolean selected;
|
||||
XtPointer userData;
|
||||
Dimension heightInPixels;
|
||||
unsigned int heightInPixelsValid:1;
|
||||
Widget grid;
|
||||
int visPos;
|
||||
XmLArray cellArray;
|
||||
} XmLGridRowPart;
|
||||
|
||||
struct _XmLGridRowRec
|
||||
{
|
||||
XmLGridRowPart grid;
|
||||
};
|
||||
|
||||
typedef struct _XmLGridColumnPart
|
||||
{
|
||||
int pos; /* required first for Array autonumber */
|
||||
Dimension width;
|
||||
unsigned char sizePolicy;
|
||||
Boolean selected;
|
||||
XtPointer userData;
|
||||
XmLGridCellRefValues *defCellValues;
|
||||
Widget grid;
|
||||
Dimension widthInPixels;
|
||||
unsigned int widthInPixelsValid:1;
|
||||
Boolean resizable;
|
||||
int visPos;
|
||||
|
||||
/* xfe additions */
|
||||
Boolean hidden;
|
||||
unsigned char sort;
|
||||
} XmLGridColumnPart;
|
||||
|
||||
struct _XmLGridColumnRec
|
||||
{
|
||||
XmLGridColumnPart grid;
|
||||
};
|
||||
|
||||
typedef struct _XmLGridPart
|
||||
{
|
||||
/* resource values */
|
||||
int leftFixedCount, rightFixedCount;
|
||||
int headingRowCount, footerRowCount;
|
||||
int topFixedCount, bottomFixedCount;
|
||||
int headingColCount, footerColCount;
|
||||
Dimension leftFixedMargin, rightFixedMargin;
|
||||
Dimension topFixedMargin, bottomFixedMargin;
|
||||
Dimension scrollBarMargin;
|
||||
Dimension highlightThickness;
|
||||
Dimension toggleSize;
|
||||
Dimension globalPixmapWidth, globalPixmapHeight;
|
||||
unsigned char selectionPolicy;
|
||||
Boolean layoutFrozen, immediateDraw;
|
||||
int debugLevel;
|
||||
unsigned char vsPolicy, hsPolicy;
|
||||
unsigned char hsbDisplayPolicy, vsbDisplayPolicy;
|
||||
int rowCount, colCount;
|
||||
int hiddenRowCount, hiddenColCount;
|
||||
int shadowRegions;
|
||||
unsigned char shadowType;
|
||||
Widget hsb, vsb, text;
|
||||
XmFontList fontList;
|
||||
Pixel blankBg, selectBg, selectFg;
|
||||
Pixel defaultCellBg, defaultCellFg;
|
||||
Pixel toggleTopColor, toggleBotColor;
|
||||
int visibleCols, visibleRows;
|
||||
char *simpleHeadings, *simpleWidths;
|
||||
XtTranslations editTrans, traverseTrans;
|
||||
Boolean allowRowHide, allowColHide;
|
||||
Boolean allowRowResize, allowColResize;
|
||||
Boolean allowDrag, allowDrop;
|
||||
Boolean autoSelect;
|
||||
Boolean highlightRowMode;
|
||||
Boolean useAvgWidth;
|
||||
int scrollRow, scrollCol, cScrollRow, cScrollCol;
|
||||
XtCallbackList addCallback, deleteCallback;
|
||||
XtCallbackList cellDrawCallback, cellFocusCallback;
|
||||
XtCallbackList cellDropCallback, cellPasteCallback;
|
||||
XtCallbackList activateCallback, editCallback;
|
||||
XtCallbackList selectCallback, deselectCallback;
|
||||
XtCallbackList resizeCallback, scrollCallback;
|
||||
|
||||
XtCallbackList enterCellCallback;
|
||||
XtCallbackList leaveCellCallback;
|
||||
XtCallbackList enterGridCallback;
|
||||
XtCallbackList leaveGridCallback;
|
||||
|
||||
/* XFE Additions */
|
||||
XtCallbackList popupCallback;
|
||||
Boolean hideUnhideButtons;
|
||||
Boolean singleClickActivation;
|
||||
Widget hideButton;
|
||||
Widget unhideButton;
|
||||
XtTranslations hideButtonTrans;
|
||||
XtTranslations unhideButtonTrans;
|
||||
|
||||
Boolean inResize;
|
||||
|
||||
Boolean useTextWidget;
|
||||
|
||||
Dimension iconSpacing;
|
||||
|
||||
Dimension minColWidth;
|
||||
|
||||
int lastCursorMotionRow;
|
||||
int lastCursorMotionCol;
|
||||
|
||||
unsigned char colSortType;
|
||||
|
||||
/* private data */
|
||||
GC gc;
|
||||
Cursor hResizeCursor, vResizeCursor;
|
||||
XFontStruct *fallbackFont;
|
||||
char ignoreModifyVerify;
|
||||
char focusIn, inEdit, inMode;
|
||||
char singleColScrollMode;
|
||||
int singleColScrollPos;
|
||||
char cursorDefined, textHidden, resizeIsVert;
|
||||
char mayHaveRowSpans;
|
||||
int layoutStack;
|
||||
char needsHorizLayout, needsVertLayout;
|
||||
char recalcHorizVisPos, recalcVertVisPos;
|
||||
char vertVisChangedHint;
|
||||
char dragTimerSet;
|
||||
XtIntervalId dragTimerId;
|
||||
int resizeRow, resizeCol, resizeLineXY;
|
||||
int extendRow, extendCol, extendToRow, extendToCol;
|
||||
Boolean extendSelect;
|
||||
int lastSelectRow, lastSelectCol;
|
||||
Time lastSelectTime;
|
||||
int focusRow, focusCol;
|
||||
XmLArray rowArray;
|
||||
XmLArray colArray;
|
||||
GridReg reg[9];
|
||||
GridDropLoc dropLoc;
|
||||
|
||||
/* resources use by SetSubValues and GetSubValues */
|
||||
Boolean cellDefaults;
|
||||
int cellRow, cellCol;
|
||||
int cellColRangeStart, cellColRangeEnd;
|
||||
int cellRowRangeStart, cellRowRangeEnd;
|
||||
int rowStep, colStep;
|
||||
unsigned char rowType, colType;
|
||||
Boolean colHidden;
|
||||
|
||||
/* cell resources */
|
||||
XmString cellString;
|
||||
Boolean cellToggleSet;
|
||||
Pixmap cellPixmap, cellPixmapMask;
|
||||
Dimension cellPixmapWidth, cellPixmapHeight;
|
||||
XmLGridCellRefValues cellValues, *defCellValues;
|
||||
|
||||
/* row resources */
|
||||
Dimension rowHeight;
|
||||
unsigned char rowSizePolicy;
|
||||
Boolean rowSelected;
|
||||
XtPointer rowUserData;
|
||||
|
||||
/* column resources */
|
||||
Dimension colWidth;
|
||||
unsigned char colSizePolicy;
|
||||
Boolean colSelected;
|
||||
XtPointer colUserData;
|
||||
Boolean colResizable;
|
||||
|
||||
/* xfe additions */
|
||||
/* Edit timer is used for inplace editing */
|
||||
char editTimerSet;
|
||||
XtIntervalId editTimerId;
|
||||
} XmLGridPart;
|
||||
|
||||
typedef struct _XmLGridRec
|
||||
{
|
||||
CorePart core;
|
||||
CompositePart composite;
|
||||
ConstraintPart constraint;
|
||||
XmManagerPart manager;
|
||||
XmLGridPart grid;
|
||||
} XmLGridRec;
|
||||
|
||||
typedef struct _XmLGridClassPart
|
||||
{
|
||||
int initialRows;
|
||||
int initialCols;
|
||||
XmLGridPreLayoutProc preLayoutProc;
|
||||
int rowRecSize;
|
||||
XmLGridRowNewProc rowNewProc;
|
||||
XmLGridRowFreeProc rowFreeProc;
|
||||
XmLGridGetRowValueMaskProc getRowValueMaskProc;
|
||||
XmLGridGetRowValueProc getRowValueProc;
|
||||
XmLGridSetRowValuesProc setRowValuesProc;
|
||||
int columnRecSize;
|
||||
XmLGridColumnNewProc columnNewProc;
|
||||
XmLGridColumnFreeProc columnFreeProc;
|
||||
XmLGridGetColumnValueMaskProc getColumnValueMaskProc;
|
||||
XmLGridGetColumnValueProc getColumnValueProc;
|
||||
XmLGridSetColumnValuesProc setColumnValuesProc;
|
||||
XmLGridSetCellValuesResizeProc setCellValuesResizeProc;
|
||||
XmLGridCellActionProc cellActionProc;
|
||||
} XmLGridClassPart;
|
||||
|
||||
typedef struct _XmLGridClassRec
|
||||
{
|
||||
CoreClassPart core_class;
|
||||
CompositeClassPart composite_class;
|
||||
ConstraintClassPart constraint_class;
|
||||
XmManagerClassPart manager_class;
|
||||
XmLGridClassPart grid_class;
|
||||
} XmLGridClassRec;
|
||||
|
||||
extern XmLGridClassRec xmlGridClassRec;
|
||||
|
||||
typedef struct _XmLGridConstraintPart
|
||||
{
|
||||
int unused;
|
||||
} XmLGridConstraintPart;
|
||||
|
||||
typedef struct _XmLGridConstraintRec
|
||||
{
|
||||
XmManagerConstraintPart manager;
|
||||
XmLGridConstraintPart grid;
|
||||
} XmLGridConstraintRec, *XmLGridConstraintPtr;
|
||||
|
||||
#endif
|
||||
151
mozilla/cmd/xfe/Microline3.0/XmL/GridUtil.c
Normal file
151
mozilla/cmd/xfe/Microline3.0/XmL/GridUtil.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Name: <XmL/GridUtil.c> */
|
||||
/* */
|
||||
/* Description: XmLGrid misc utilities. They are here in order not to */
|
||||
/* continue bloating Grid.c beyond hope. */
|
||||
/* */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/* Created: Thu May 28 21:55:45 PDT 1998 */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "GridP.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ int
|
||||
XmLGridGetRowCount(Widget w)
|
||||
{
|
||||
XmLGridWidget g = (XmLGridWidget) w;
|
||||
|
||||
assert( g != NULL );
|
||||
|
||||
#ifdef DEBUG_ramiro
|
||||
{
|
||||
int rows = 0;
|
||||
|
||||
XtVaGetValues(w,XmNrows,&rows,NULL);
|
||||
|
||||
assert( rows == g->grid.rowCount );
|
||||
}
|
||||
#endif
|
||||
|
||||
return g->grid.rowCount;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ int
|
||||
XmLGridGetColumnCount(Widget w)
|
||||
{
|
||||
XmLGridWidget g = (XmLGridWidget) w;
|
||||
|
||||
assert( g != NULL );
|
||||
|
||||
#ifdef DEBUG_ramiro
|
||||
{
|
||||
int columns = 0;
|
||||
|
||||
XtVaGetValues(w,XmNcolumns,&columns,NULL);
|
||||
|
||||
assert( columns == g->grid.colCount );
|
||||
}
|
||||
#endif
|
||||
|
||||
return g->grid.colCount;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XmLGridXYToCellTracking(Widget widget,
|
||||
int x, /* input only args. */
|
||||
int y, /* input only args. */
|
||||
Boolean * m_inGrid, /* input/output args. */
|
||||
int * m_lastRow, /* input/output args. */
|
||||
int * m_lastCol, /* input/output args. */
|
||||
unsigned char * m_lastRowtype, /* input/output args. */
|
||||
unsigned char * m_lastColtype,/* input/output args. */
|
||||
int * outRow, /* output only args. */
|
||||
int * outCol, /* output only args. */
|
||||
Boolean * enter, /* output only args. */
|
||||
Boolean * leave) /* output only args. */
|
||||
{
|
||||
int m_totalLines = 0;
|
||||
int m_numcolumns = 0;
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
unsigned char rowtype = XmCONTENT;
|
||||
unsigned char coltype = XmCONTENT;
|
||||
|
||||
if (0 > XmLGridXYToRowColumn(widget,
|
||||
x,
|
||||
y,
|
||||
&rowtype,
|
||||
&row,
|
||||
&coltype,
|
||||
&column))
|
||||
{
|
||||
/* In grid; but, not in any cells
|
||||
*/
|
||||
/* treat it as a leave
|
||||
*/
|
||||
*enter = FALSE;
|
||||
*leave = TRUE;
|
||||
return;
|
||||
}/* if */
|
||||
|
||||
m_totalLines = XmLGridGetRowCount(widget);
|
||||
m_numcolumns = XmLGridGetColumnCount(widget);
|
||||
|
||||
if ((row < m_totalLines) &&
|
||||
(column < m_numcolumns) &&
|
||||
((*m_lastRow != row)||
|
||||
(*m_lastCol != column) ||
|
||||
(*m_lastRowtype != rowtype)||
|
||||
(*m_lastColtype != coltype)))
|
||||
{
|
||||
*outRow = (rowtype == XmHEADING)?-1:row;
|
||||
*outCol = column;
|
||||
|
||||
if (*m_inGrid == False)
|
||||
{
|
||||
*m_inGrid = True;
|
||||
|
||||
/* enter a cell
|
||||
*/
|
||||
*enter = TRUE;
|
||||
*leave = FALSE;
|
||||
|
||||
}/* if */
|
||||
else
|
||||
{
|
||||
/* Cruising among cells
|
||||
*/
|
||||
*enter = TRUE;
|
||||
*leave = TRUE;
|
||||
}/* else */
|
||||
*m_lastRow = row;
|
||||
*m_lastCol = column;
|
||||
*m_lastRowtype = rowtype ;
|
||||
*m_lastColtype = coltype ;
|
||||
}/* row /col in grid */
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
82
mozilla/cmd/xfe/Microline3.0/XmL/Makefile
Normal file
82
mozilla/cmd/xfe/Microline3.0/XmL/Makefile
Normal file
@@ -0,0 +1,82 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
#
|
||||
# The following source code is part of the Microline Widget Library.
|
||||
# The Microline widget library is made available to Mozilla developers
|
||||
# under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
# more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
# http://www.neurondata.com.
|
||||
#
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
# Name: Makefile
|
||||
# Description: Makefile for Microline Widget library
|
||||
# Author: Ramiro Estrugo <ramiro@netscape.com>
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
# XmL headers are exported to dist/public/Microline/XmL
|
||||
MODULE = Microline/XmL
|
||||
|
||||
LIBRARY_NAME = XmL
|
||||
|
||||
# There are unused widgets. They are currently not needed to build Mozilla,
|
||||
# but that might change in the future.
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
UNUSED_CSRCS = \
|
||||
Progress.c \
|
||||
$(NULL)
|
||||
|
||||
UNUSED_EXPORTS = \
|
||||
Progress.h \
|
||||
ProgressP.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
$(UNUSED_CSRCS) \
|
||||
Folder.c \
|
||||
Grid.c \
|
||||
GridUtil.c \
|
||||
Tree.c \
|
||||
XmL.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = Microline
|
||||
|
||||
EXPORTS = \
|
||||
$(UNUSED_EXPORTS) \
|
||||
Folder.h \
|
||||
FolderP.h \
|
||||
Grid.h \
|
||||
GridP.h \
|
||||
Tree.h \
|
||||
TreeP.h \
|
||||
XmL.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
DEFINES += $(XFE_EXTRA_DEFINES)
|
||||
89
mozilla/cmd/xfe/Microline3.0/XmL/Makefile.in
Normal file
89
mozilla/cmd/xfe/Microline3.0/XmL/Makefile.in
Normal file
@@ -0,0 +1,89 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
#
|
||||
# The following source code is part of the Microline Widget Library.
|
||||
# The Microline widget library is made available to Mozilla developers
|
||||
# under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
# more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
# http://www.neurondata.com.
|
||||
#
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
# Name: Makefile
|
||||
# Description: Makefile for Microline Widget library
|
||||
# Author: Ramiro Estrugo <ramiro@netscape.com>
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# XmL headers are exported to dist/public/Microline/XmL
|
||||
MODULE = Microline/XmL
|
||||
|
||||
LIBRARY_NAME = XmL
|
||||
|
||||
# There are unused widgets. They are currently not needed to build Mozilla,
|
||||
# but that might change in the future.
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
UNUSED_CSRCS = \
|
||||
Progress.c \
|
||||
$(NULL)
|
||||
|
||||
UNUSED_EXPORTS = \
|
||||
Progress.h \
|
||||
ProgressP.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
$(UNUSED_CSRCS) \
|
||||
Folder.c \
|
||||
Grid.c \
|
||||
GridUtil.c \
|
||||
Tree.c \
|
||||
XmL.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = Microline
|
||||
|
||||
EXPORTS = \
|
||||
$(UNUSED_EXPORTS) \
|
||||
Folder.h \
|
||||
FolderP.h \
|
||||
Grid.h \
|
||||
GridP.h \
|
||||
Tree.h \
|
||||
TreeP.h \
|
||||
XmL.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += $(XFE_EXTRA_DEFINES)
|
||||
601
mozilla/cmd/xfe/Microline3.0/XmL/Progress.c
Normal file
601
mozilla/cmd/xfe/Microline3.0/XmL/Progress.c
Normal file
@@ -0,0 +1,601 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
#include "ProgressP.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
static void ClassInitialize(void);
|
||||
static void Initialize(Widget , Widget, ArgList, Cardinal *);
|
||||
static void Resize(Widget);
|
||||
static void Destroy(Widget);
|
||||
static void Realize(Widget w, XtValueMask *valueMask,
|
||||
XSetWindowAttributes *attr);
|
||||
static void Redisplay(Widget, XEvent *, Region);
|
||||
static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *);
|
||||
static void CopyFontList(XmLProgressWidget p);
|
||||
static void TimeStr(char *, int);
|
||||
static void DrawBarMeter(XmLProgressWidget p, XRectangle *rect);
|
||||
static void DrawBoxesMeter(XmLProgressWidget p, XRectangle *rect);
|
||||
static void DrawString(XmLProgressWidget, XmString, int, int,
|
||||
int, XRectangle *, XRectangle *);
|
||||
static Boolean CvtStringToMeterStyle(Display *dpy, XrmValuePtr args,
|
||||
Cardinal *numArgs, XrmValuePtr fromVal, XrmValuePtr toVal,
|
||||
XtPointer *data);
|
||||
|
||||
static XtResource resources[] =
|
||||
{
|
||||
{
|
||||
XmNcompleteValue, XmCCompleteValue,
|
||||
XtRInt, sizeof(int),
|
||||
XtOffset(XmLProgressWidget, progress.completeValue),
|
||||
XtRImmediate, (caddr_t)100
|
||||
},
|
||||
{
|
||||
XmNnumBoxes, XmCNumBoxes,
|
||||
XtRInt, sizeof(int),
|
||||
XtOffset(XmLProgressWidget, progress.numBoxes),
|
||||
XtRImmediate, (caddr_t)10
|
||||
},
|
||||
{
|
||||
XmNvalue, XmCValue,
|
||||
XtRInt, sizeof(int),
|
||||
XtOffset(XmLProgressWidget, progress.value),
|
||||
XtRImmediate, (caddr_t)0
|
||||
},
|
||||
{
|
||||
XmNfontList, XmCFontList,
|
||||
XmRFontList, sizeof(XmFontList),
|
||||
XtOffset(XmLProgressWidget, progress.fontList),
|
||||
XmRImmediate, (XtPointer)0,
|
||||
},
|
||||
{
|
||||
XmNmeterStyle, XmCMeterStyle,
|
||||
XmRMeterStyle, sizeof(unsigned char),
|
||||
XtOffset(XmLProgressWidget, progress.meterStyle),
|
||||
XmRImmediate, (XtPointer)XmMETER_BAR,
|
||||
},
|
||||
{
|
||||
XmNshowTime, XmCShowTime,
|
||||
XmRBoolean, sizeof(Boolean),
|
||||
XtOffset(XmLProgressWidget, progress.showTime),
|
||||
XmRImmediate, (XtPointer)False
|
||||
},
|
||||
{
|
||||
XmNshowPercentage, XmCShowPercentage,
|
||||
XmRBoolean, sizeof(Boolean),
|
||||
XtOffset(XmLProgressWidget, progress.showPercentage),
|
||||
XmRImmediate, (XtPointer)True
|
||||
}
|
||||
};
|
||||
|
||||
XmLProgressClassRec xmlProgressClassRec =
|
||||
{
|
||||
{ /* Core */
|
||||
(WidgetClass)&xmPrimitiveClassRec, /* superclass */
|
||||
"XmLProgress", /* class_name */
|
||||
sizeof(XmLProgressRec), /* widget_size */
|
||||
ClassInitialize, /* class_initialize */
|
||||
NULL, /* class_part_initialize */
|
||||
FALSE, /* class_inited */
|
||||
(XtInitProc)Initialize, /* initialize */
|
||||
NULL, /* initialize_hook */
|
||||
(XtRealizeProc)Realize, /* realize */
|
||||
NULL, /* actions */
|
||||
0, /* num_actions */
|
||||
resources, /* resources */
|
||||
XtNumber(resources), /* num_resources */
|
||||
NULLQUARK, /* xrm_class */
|
||||
TRUE, /* compress_motion */
|
||||
FALSE, /* compress_exposure */
|
||||
TRUE, /* compress_enterleave */
|
||||
TRUE, /* visible_interest */
|
||||
(XtWidgetProc)Destroy, /* destroy */
|
||||
(XtWidgetProc)Resize, /* resize */
|
||||
(XtExposeProc)Redisplay, /* expose */
|
||||
(XtSetValuesFunc)SetValues, /* set_values */
|
||||
NULL, /* set_values_hook */
|
||||
XtInheritSetValuesAlmost, /* set_values_almost */
|
||||
NULL, /* get_values_hook */
|
||||
NULL, /* accept_focus */
|
||||
XtVersion, /* version */
|
||||
NULL, /* callback_private */
|
||||
XtInheritTranslations, /* tm_table */
|
||||
NULL, /* query_geometry */
|
||||
NULL, /* display_accelerator */
|
||||
NULL, /* extension */
|
||||
},
|
||||
{ /* Primitive */
|
||||
(XtWidgetProc)_XtInherit, /* border_highlight */
|
||||
(XtWidgetProc)_XtInherit, /* border_unhighlight */
|
||||
XtInheritTranslations, /* translations */
|
||||
NULL, /* arm_and_activate */
|
||||
NULL, /* syn_resources */
|
||||
0, /* num_syn_resources */
|
||||
NULL, /* extension */
|
||||
},
|
||||
{ /* Progress */
|
||||
0, /* unused */
|
||||
}
|
||||
};
|
||||
|
||||
WidgetClass xmlProgressWidgetClass = (WidgetClass)&xmlProgressClassRec;
|
||||
|
||||
static void
|
||||
ClassInitialize(void)
|
||||
{
|
||||
XmLInitialize();
|
||||
|
||||
XtSetTypeConverter(XmRString, XmRMeterStyle, CvtStringToMeterStyle,
|
||||
0, 0, XtCacheNone, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
Initialize(Widget reqW,
|
||||
Widget newW,
|
||||
ArgList args,
|
||||
Cardinal *narg)
|
||||
{
|
||||
XmLProgressWidget p;
|
||||
|
||||
p = (XmLProgressWidget)newW;
|
||||
|
||||
if (!p->core.width)
|
||||
p->core.width = 200;
|
||||
if (!p->core.height)
|
||||
p->core.height = 30;
|
||||
|
||||
p->progress.gc = 0;
|
||||
p->progress.startTime = time(0);
|
||||
CopyFontList(p);
|
||||
if (p->progress.completeValue < 1)
|
||||
{
|
||||
XmLWarning(newW, "Initialize() - complete value can't be < 1");
|
||||
p->progress.completeValue = 1;
|
||||
}
|
||||
if (p->progress.numBoxes < 1)
|
||||
{
|
||||
XmLWarning(newW, "Initialize() - number of boxes can't be < 1");
|
||||
p->progress.numBoxes = 1;
|
||||
}
|
||||
if (p->progress.value < 0)
|
||||
{
|
||||
XmLWarning(newW, "Initialize() - value can't be < 0");
|
||||
p->progress.value = 0;
|
||||
}
|
||||
if (p->progress.value > p->progress.completeValue)
|
||||
{
|
||||
XmLWarning(newW, "Initialize() - value can't be > completeValue");
|
||||
p->progress.value = p->progress.completeValue;
|
||||
}
|
||||
XtVaSetValues(newW, XmNtraversalOn, False, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
Resize(Widget w)
|
||||
{
|
||||
Display *dpy;
|
||||
Window win;
|
||||
|
||||
if (!XtIsRealized(w))
|
||||
return;
|
||||
dpy = XtDisplay(w);
|
||||
win = XtWindow(w);
|
||||
XClearArea(dpy, win, 0, 0, 0, 0, True);
|
||||
}
|
||||
|
||||
static void
|
||||
Destroy(Widget w)
|
||||
{
|
||||
Display *dpy;
|
||||
XmLProgressWidget p;
|
||||
|
||||
p = (XmLProgressWidget)w;
|
||||
dpy = XtDisplay(w);
|
||||
if (p->progress.gc)
|
||||
{
|
||||
XFreeGC(dpy, p->progress.gc);
|
||||
XFreeFont(dpy, p->progress.fallbackFont);
|
||||
}
|
||||
XmFontListFree(p->progress.fontList);
|
||||
}
|
||||
|
||||
static void
|
||||
Realize(Widget w,
|
||||
XtValueMask *valueMask,
|
||||
XSetWindowAttributes *attr)
|
||||
{
|
||||
XmLProgressWidget p;
|
||||
Display *dpy;
|
||||
WidgetClass superClass;
|
||||
XtRealizeProc realize;
|
||||
XGCValues values;
|
||||
/* XtGCMask mask;*/
|
||||
|
||||
p = (XmLProgressWidget)w;
|
||||
dpy = XtDisplay(p);
|
||||
superClass = xmlProgressWidgetClass->core_class.superclass;
|
||||
realize = superClass->core_class.realize;
|
||||
(*realize)(w, valueMask, attr);
|
||||
|
||||
if (!p->progress.gc)
|
||||
{
|
||||
p->progress.fallbackFont = XLoadQueryFont(dpy, "fixed");
|
||||
values.font = p->progress.fallbackFont->fid;
|
||||
p->progress.gc = XCreateGC(dpy, XtWindow(p), GCFont, &values);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Redisplay(Widget w,
|
||||
XEvent *event,
|
||||
Region region)
|
||||
{
|
||||
XmLProgressWidget p;
|
||||
Display *dpy;
|
||||
Window win;
|
||||
XRectangle rect;
|
||||
int st;
|
||||
|
||||
if (!XtIsRealized(w) || !w->core.visible)
|
||||
return;
|
||||
|
||||
p = (XmLProgressWidget)w;
|
||||
dpy = XtDisplay(w);
|
||||
win = XtWindow(w);
|
||||
st = p->primitive.shadow_thickness;
|
||||
rect.x = st;
|
||||
rect.y = st;
|
||||
rect.width = p->core.width - st * 2;
|
||||
rect.height = p->core.height - st * 2;
|
||||
|
||||
if (p->progress.meterStyle == XmMETER_BAR)
|
||||
DrawBarMeter(p, &rect);
|
||||
else if (p->progress.meterStyle == XmMETER_BOXES)
|
||||
DrawBoxesMeter(p, &rect);
|
||||
|
||||
#ifdef MOTIF11
|
||||
_XmDrawShadow(dpy, win,
|
||||
p->primitive.bottom_shadow_GC,
|
||||
p->primitive.top_shadow_GC,
|
||||
p->primitive.shadow_thickness,
|
||||
0, 0, p->core.width, p->core.height);
|
||||
#else
|
||||
_XmDrawShadows(dpy, win,
|
||||
p->primitive.top_shadow_GC,
|
||||
p->primitive.bottom_shadow_GC,
|
||||
0, 0, p->core.width, p->core.height,
|
||||
p->primitive.shadow_thickness,
|
||||
XmSHADOW_IN);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
DrawBoxesMeter(XmLProgressWidget p,
|
||||
XRectangle *rect)
|
||||
{
|
||||
Display *dpy;
|
||||
Window win;
|
||||
int i, j, st, nb, x1, x2;
|
||||
|
||||
dpy = XtDisplay(p);
|
||||
win = XtWindow(p);
|
||||
st = p->primitive.shadow_thickness;
|
||||
nb = p->progress.numBoxes;
|
||||
if (nb * st * 2 > (int)rect->width)
|
||||
return;
|
||||
|
||||
if (p->progress.completeValue)
|
||||
j = (int)((long)nb * (long)p->progress.value /
|
||||
(long)p->progress.completeValue);
|
||||
else
|
||||
j = 0;
|
||||
x2 = 0;
|
||||
for (i = 0; i < nb; i++)
|
||||
{
|
||||
if (i < j)
|
||||
XSetForeground(dpy, p->progress.gc, p->primitive.foreground);
|
||||
else
|
||||
XSetForeground(dpy, p->progress.gc, p->core.background_pixel);
|
||||
x1 = x2;
|
||||
if (i == nb - 1)
|
||||
x2 = rect->width;
|
||||
else
|
||||
x2 = ((int)rect->width * (i + 1)) / nb;
|
||||
XFillRectangle(dpy, win, p->progress.gc,
|
||||
rect->x + x1 + st, rect->y + st,
|
||||
x2 - x1 - st * 2, rect->height - st * 2);
|
||||
#ifdef MOTIF11
|
||||
_XmDrawShadow(dpy, win,
|
||||
p->primitive.bottom_shadow_GC,
|
||||
p->primitive.top_shadow_GC,
|
||||
p->primitive.shadow_thickness,
|
||||
rect->x + x1, rect->y,
|
||||
x2 - x1, rect->height);
|
||||
#else
|
||||
_XmDrawShadows(dpy, win,
|
||||
p->primitive.top_shadow_GC,
|
||||
p->primitive.bottom_shadow_GC,
|
||||
rect->x + x1, rect->y,
|
||||
x2 - x1, rect->height,
|
||||
p->primitive.shadow_thickness,
|
||||
XmSHADOW_IN);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DrawBarMeter(XmLProgressWidget p,
|
||||
XRectangle *rect)
|
||||
{
|
||||
Display *dpy;
|
||||
Window win;
|
||||
int timeLeft, timeSoFar;
|
||||
time_t currentTime;
|
||||
XmString str;
|
||||
Dimension strWidth, strHeight;
|
||||
XRectangle lRect, rRect;
|
||||
int percent;
|
||||
char c[10];
|
||||
long l;
|
||||
|
||||
dpy = XtDisplay(p);
|
||||
win = XtWindow(p);
|
||||
|
||||
/* Left Rect */
|
||||
if (p->progress.completeValue)
|
||||
l = (long)rect->width * (long)p->progress.value /
|
||||
(long)p->progress.completeValue;
|
||||
else
|
||||
l = 0;
|
||||
lRect.x = rect->x;
|
||||
lRect.y = rect->y;
|
||||
lRect.width = (Dimension)l;
|
||||
lRect.height = rect->height;
|
||||
XSetForeground(dpy, p->progress.gc, p->primitive.foreground);
|
||||
XFillRectangle(dpy, win, p->progress.gc, lRect.x, lRect.y,
|
||||
lRect.width, lRect.height);
|
||||
|
||||
/* Right Rect */
|
||||
rRect.x = rect->x + (int)l;
|
||||
rRect.y = rect->y;
|
||||
rRect.width = rect->width - (Dimension)l;
|
||||
rRect.height = rect->height;
|
||||
XSetForeground(dpy, p->progress.gc, p->core.background_pixel);
|
||||
XFillRectangle(dpy, win, p->progress.gc, rRect.x, rRect.y,
|
||||
rRect.width, rRect.height);
|
||||
|
||||
if (p->progress.completeValue)
|
||||
percent = (int)(((long)p->progress.value * 100) /
|
||||
(long)p->progress.completeValue);
|
||||
else
|
||||
percent = 0;
|
||||
|
||||
/* percent complete */
|
||||
sprintf(c, "%d%c", percent, '%');
|
||||
str = XmStringCreateSimple(c);
|
||||
XmStringExtent(p->progress.fontList, str, &strWidth, &strHeight);
|
||||
if (p->progress.showPercentage)
|
||||
DrawString(p, str, rect->x + rect->width / 2 - (int)strWidth / 2,
|
||||
rect->y + rect->height / 2 - (int)strHeight / 2, strWidth,
|
||||
&lRect, &rRect);
|
||||
XmStringFree(str);
|
||||
|
||||
/* Left Time */
|
||||
currentTime = time(0);
|
||||
timeSoFar = (int)(currentTime - p->progress.startTime);
|
||||
if (p->progress.showTime && p->progress.value &&
|
||||
p->progress.value != p->progress.completeValue && timeSoFar)
|
||||
{
|
||||
TimeStr(c, timeSoFar);
|
||||
str = XmStringCreateSimple(c);
|
||||
XmStringExtent(p->progress.fontList, str,
|
||||
&strWidth, &strHeight);
|
||||
DrawString(p, str, rect->x + 5, rect->y + rect->height / 2 -
|
||||
(int)strHeight / 2, strWidth, &lRect, &rRect);
|
||||
XmStringFree(str);
|
||||
}
|
||||
|
||||
/* Right Time */
|
||||
timeLeft = 0;
|
||||
if (percent)
|
||||
timeLeft = (timeSoFar * 100 / percent) - timeSoFar;
|
||||
if (p->progress.showTime && percent && percent != 100 && timeLeft)
|
||||
{
|
||||
TimeStr(c, timeLeft);
|
||||
str = XmStringCreateSimple(c);
|
||||
XmStringExtent(p->progress.fontList, str,
|
||||
&strWidth, &strHeight);
|
||||
DrawString(p, str, rect->x + rect->width - strWidth - 5,
|
||||
rect->y + rect->height / 2 - (int)strHeight / 2,
|
||||
strWidth, &lRect, &rRect);
|
||||
XmStringFree(str);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DrawString(XmLProgressWidget p,
|
||||
XmString str,
|
||||
int x,
|
||||
int y,
|
||||
int strWidth,
|
||||
XRectangle *lRect,
|
||||
XRectangle *rRect)
|
||||
{
|
||||
Display *dpy;
|
||||
Window win;
|
||||
|
||||
dpy = XtDisplay(p);
|
||||
win = XtWindow(p);
|
||||
if (lRect->width && lRect->height)
|
||||
{
|
||||
XSetForeground(dpy, p->progress.gc, p->core.background_pixel);
|
||||
XSetClipRectangles(dpy, p->progress.gc, 0, 0, lRect, 1, Unsorted);
|
||||
XmStringDraw(dpy, win, p->progress.fontList, str,
|
||||
p->progress.gc, x, y, strWidth, XmALIGNMENT_BEGINNING,
|
||||
XmSTRING_DIRECTION_L_TO_R, 0);
|
||||
XSetClipMask(dpy, p->progress.gc, None);
|
||||
}
|
||||
if (rRect->width && rRect->height)
|
||||
{
|
||||
XSetForeground(dpy, p->progress.gc, p->primitive.foreground);
|
||||
XSetClipRectangles(dpy, p->progress.gc, 0, 0, rRect, 1, Unsorted);
|
||||
XmStringDraw(dpy, win, p->progress.fontList, str,
|
||||
p->progress.gc, x, y, strWidth, XmALIGNMENT_BEGINNING,
|
||||
XmSTRING_DIRECTION_L_TO_R, 0);
|
||||
XSetClipMask(dpy, p->progress.gc, None);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
TimeStr(char *c,
|
||||
int seconds)
|
||||
{
|
||||
int h, m, s;
|
||||
|
||||
s = seconds;
|
||||
m = s / 60;
|
||||
s -= m * 60;
|
||||
h = m / 60;
|
||||
m -= h * 60;
|
||||
if (h > 99)
|
||||
h = 99;
|
||||
if (h > 0 && m < 10)
|
||||
sprintf(c, "%d:0%d hr", h, m);
|
||||
else if (h > 0)
|
||||
sprintf(c, "%d:%d hr", h, m);
|
||||
else if (m > 0 && s < 10)
|
||||
sprintf(c, "%d:0%d min", m, s);
|
||||
else if (m > 0)
|
||||
sprintf(c, "%d:%d min", m, s);
|
||||
else
|
||||
sprintf(c, "%d sec", s);
|
||||
}
|
||||
|
||||
static Boolean
|
||||
SetValues(Widget curW,
|
||||
Widget reqW,
|
||||
Widget newW,
|
||||
ArgList args,
|
||||
Cardinal *narg)
|
||||
{
|
||||
XmLProgressWidget cur, p;
|
||||
XtAppContext app;
|
||||
|
||||
cur = (XmLProgressWidget)curW;
|
||||
p = (XmLProgressWidget)newW;
|
||||
app = XtWidgetToApplicationContext(curW);
|
||||
if (p->progress.value == 0)
|
||||
p->progress.startTime = time(0);
|
||||
if (p->progress.completeValue < 1)
|
||||
{
|
||||
XmLWarning(newW, "SetValues() - complete value can't be < 1");
|
||||
p->progress.completeValue = 1;
|
||||
}
|
||||
if (p->progress.numBoxes < 1)
|
||||
{
|
||||
XmLWarning(newW, "SetValues() - number of boxes can't be < 1");
|
||||
p->progress.numBoxes = 1;
|
||||
}
|
||||
if (p->progress.value < 0)
|
||||
{
|
||||
XmLWarning(newW, "SetValues() - value can't be < 0");
|
||||
p->progress.value = 0;
|
||||
}
|
||||
if (p->progress.value > p->progress.completeValue)
|
||||
{
|
||||
XmLWarning(newW, "SetValues() - value can't be > completeValue");
|
||||
p->progress.value = p->progress.completeValue;
|
||||
}
|
||||
if (p->progress.fontList != cur->progress.fontList)
|
||||
{
|
||||
XmFontListFree(cur->progress.fontList);
|
||||
CopyFontList(p);
|
||||
}
|
||||
/* display changes immediately since we may be not get back
|
||||
to XNextEvent if the calling application is computing */
|
||||
if (p->core.background_pixel != cur->core.background_pixel ||
|
||||
p->primitive.foreground != cur->primitive.foreground ||
|
||||
p->progress.value != cur->progress.value ||
|
||||
p->progress.completeValue != cur->progress.completeValue ||
|
||||
p->progress.fontList != cur->progress.fontList ||
|
||||
p->progress.showTime != cur->progress.showTime ||
|
||||
p->progress.showPercentage != cur->progress.showPercentage ||
|
||||
p->progress.meterStyle != cur->progress.meterStyle ||
|
||||
p->progress.numBoxes != cur->progress.numBoxes ||
|
||||
p->primitive.shadow_thickness != cur->primitive.shadow_thickness)
|
||||
{
|
||||
Redisplay(newW, 0, 0);
|
||||
XFlush(XtDisplay(newW));
|
||||
XmUpdateDisplay(newW);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
CopyFontList(XmLProgressWidget p)
|
||||
{
|
||||
if (!p->progress.fontList)
|
||||
p->progress.fontList = XmLFontListCopyDefault((Widget)p);
|
||||
else
|
||||
p->progress.fontList = XmFontListCopy(p->progress.fontList);
|
||||
if (!p->progress.fontList)
|
||||
XmLWarning((Widget)p, "- fatal error - font list NULL");
|
||||
}
|
||||
|
||||
static Boolean
|
||||
CvtStringToMeterStyle(Display *dpy,
|
||||
XrmValuePtr args,
|
||||
Cardinal *narg,
|
||||
XrmValuePtr fromVal,
|
||||
XrmValuePtr toVal,
|
||||
XtPointer *data)
|
||||
{
|
||||
static XmLStringToUCharMap map[] =
|
||||
{
|
||||
{ "METER_BAR", XmMETER_BAR },
|
||||
{ "METER_BOXES", XmMETER_BOXES },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
return XmLCvtStringToUChar(dpy, "XmRMeterStyle", map, fromVal, toVal);
|
||||
}
|
||||
|
||||
/*
|
||||
Public Functions
|
||||
*/
|
||||
|
||||
Widget
|
||||
XmLCreateProgress(Widget parent,
|
||||
char *name,
|
||||
ArgList arglist,
|
||||
Cardinal argcount)
|
||||
{
|
||||
return XtCreateWidget(name, xmlProgressWidgetClass, parent,
|
||||
arglist, argcount);
|
||||
}
|
||||
|
||||
|
||||
57
mozilla/cmd/xfe/Microline3.0/XmL/Progress.h
Normal file
57
mozilla/cmd/xfe/Microline3.0/XmL/Progress.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLProgressH
|
||||
#define XmLProgressH
|
||||
|
||||
#include <XmL/XmL.h>
|
||||
|
||||
#ifdef XmL_CPP
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern WidgetClass xmlProgressWidgetClass;
|
||||
typedef struct _XmLProgressClassRec *XmLProgressWidgetClass;
|
||||
typedef struct _XmLProgressRec *XmLProgressWidget;
|
||||
|
||||
#define XmLIsProgress(w) XtIsSubclass((w), xmlProgressWidgetClass)
|
||||
|
||||
#ifdef XmL_ANSIC
|
||||
|
||||
Widget XmLCreateProgress(Widget parent, char *name, ArgList arglist,
|
||||
Cardinal argcount);
|
||||
|
||||
#else
|
||||
|
||||
Widget XmLCreateProgress();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef XmL_CPP
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
76
mozilla/cmd/xfe/Microline3.0/XmL/ProgressP.h
Normal file
76
mozilla/cmd/xfe/Microline3.0/XmL/ProgressP.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLProgressPH
|
||||
#define XmLProgressPH
|
||||
|
||||
#include <Xm/XmP.h>
|
||||
#include <X11/StringDefs.h>
|
||||
#ifdef MOTIF11
|
||||
#else
|
||||
#include <Xm/PrimitiveP.h>
|
||||
#include <Xm/DrawP.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "Progress.h"
|
||||
|
||||
typedef struct _XmLProgressPart
|
||||
{
|
||||
int completeValue, value;
|
||||
Boolean showTime;
|
||||
Boolean showPercentage;
|
||||
XmFontList fontList;
|
||||
GC gc;
|
||||
time_t startTime;
|
||||
XFontStruct *fallbackFont;
|
||||
unsigned char meterStyle;
|
||||
int numBoxes;
|
||||
} XmLProgressPart;
|
||||
|
||||
typedef struct _XmLProgressRec
|
||||
{
|
||||
CorePart core;
|
||||
XmPrimitivePart primitive;
|
||||
XmLProgressPart progress;
|
||||
} XmLProgressRec;
|
||||
|
||||
typedef struct _XmLProgressClassPart
|
||||
{
|
||||
int null;
|
||||
} XmLProgressClassPart;
|
||||
|
||||
typedef struct _XmLProgressClassRec
|
||||
{
|
||||
CoreClassPart core_class;
|
||||
XmPrimitiveClassPart primitive_class;
|
||||
XmLProgressClassPart progress_class;
|
||||
} XmLProgressClassRec;
|
||||
|
||||
extern XmLProgressClassRec xmlProgressClassRec;
|
||||
|
||||
#endif
|
||||
1390
mozilla/cmd/xfe/Microline3.0/XmL/Tree.c
Normal file
1390
mozilla/cmd/xfe/Microline3.0/XmL/Tree.c
Normal file
File diff suppressed because it is too large
Load Diff
56
mozilla/cmd/xfe/Microline3.0/XmL/Tree.h
Normal file
56
mozilla/cmd/xfe/Microline3.0/XmL/Tree.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLTreeH
|
||||
#define XmLTreeH
|
||||
|
||||
#include <XmL/XmL.h>
|
||||
#include <XmL/Grid.h>
|
||||
|
||||
#ifdef XmL_CPP
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern WidgetClass xmlTreeWidgetClass;
|
||||
typedef struct _XmLTreeClassRec *XmLTreeWidgetClass;
|
||||
typedef struct _XmLTreeRec *XmLTreeWidget;
|
||||
typedef struct _XmLTreeRowRec *XmLTreeRow;
|
||||
|
||||
#define XmLIsTree(w) XtIsSubclass((w), xmlTreeWidgetClass)
|
||||
|
||||
Widget XmLCreateTree(Widget parent, char *name, ArgList arglist,
|
||||
Cardinal argcount);
|
||||
void XmLTreeAddRow(Widget w, int level, Boolean expands, Boolean isExpaned,
|
||||
int position, Pixmap pixmap, Pixmap pixmask, XmString string);
|
||||
void XmLTreeAddRows(Widget w, XmLTreeRowDefinition *rows,
|
||||
int count, int position);
|
||||
void XmLTreeDeleteChildren(Widget w, int position);
|
||||
|
||||
#ifdef XmL_CPP
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
125
mozilla/cmd/xfe/Microline3.0/XmL/TreeP.h
Normal file
125
mozilla/cmd/xfe/Microline3.0/XmL/TreeP.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLTreePH
|
||||
#define XmLTreePH
|
||||
|
||||
#include <Xm/XmP.h>
|
||||
#ifndef MOTIF11
|
||||
#include <Xm/ManagerP.h>
|
||||
#include <Xm/DrawP.h>
|
||||
#endif
|
||||
|
||||
#include "Tree.h"
|
||||
#include "GridP.h"
|
||||
|
||||
/* row value mask for get/set values */
|
||||
#define RVML XmLGridRowValueMaskLen
|
||||
#define XmLTreeRowLevel (1L << (RVML))
|
||||
#define XmLTreeRowExpands (1L << (RVML + 1))
|
||||
#define XmLTreeRowIsExpanded (1L << (RVML + 2))
|
||||
|
||||
typedef struct _XmLTreeRowPart
|
||||
{
|
||||
Boolean expands;
|
||||
int level;
|
||||
Boolean hasChildren, hasSiblings, isExpanded;
|
||||
Dimension stringWidth;
|
||||
Boolean stringWidthValid;
|
||||
} XmLTreeRowPart;
|
||||
|
||||
struct _XmLTreeRowRec
|
||||
{
|
||||
XmLGridRowPart grid;
|
||||
XmLTreeRowPart tree;
|
||||
};
|
||||
|
||||
typedef struct _XmLTreePart
|
||||
{
|
||||
/* resources */
|
||||
Dimension levelSpacing;
|
||||
Pixel lineColor, pmColor;
|
||||
XtCallbackList collapseCallback, expandCallback;
|
||||
|
||||
/* private data */
|
||||
char *linesData;
|
||||
int linesSize, linesMaxLevel;
|
||||
int recalcTreeWidth;
|
||||
|
||||
char defaultPixmapsCreated;
|
||||
Pixel pixColors[4];
|
||||
Pixmap filePixmask, folderPixmask, folderOpenPixmask;
|
||||
Pixmap filePixmap, folderPixmap, folderOpenPixmap;
|
||||
|
||||
/* row resources */
|
||||
int rowLevel;
|
||||
Boolean rowExpands, rowIsExpanded;
|
||||
|
||||
/* Causes the tree to NOT render any pixmaps */
|
||||
Boolean ignorePixmaps;
|
||||
} XmLTreePart;
|
||||
|
||||
typedef struct _XmLTreeRec
|
||||
{
|
||||
CorePart core;
|
||||
CompositePart composite;
|
||||
ConstraintPart constraint;
|
||||
XmManagerPart manager;
|
||||
XmLGridPart grid;
|
||||
XmLTreePart tree;
|
||||
} XmLTreeRec;
|
||||
|
||||
typedef struct _XmLTreeClassPart
|
||||
{
|
||||
int unused;
|
||||
} XmLTreeClassPart;
|
||||
|
||||
typedef struct _XmLTreeClassRec
|
||||
{
|
||||
CoreClassPart core_class;
|
||||
CompositeClassPart composite_class;
|
||||
ConstraintClassPart constraint_class;
|
||||
XmManagerClassPart manager_class;
|
||||
XmLGridClassPart grid_class;
|
||||
XmLTreeClassPart tree_class;
|
||||
} XmLTreeClassRec;
|
||||
|
||||
extern XmLTreeClassRec xmlTreeClassRec;
|
||||
|
||||
typedef struct _XmLTreeConstraintPart
|
||||
{
|
||||
int unused;
|
||||
} XmLTreeConstraintPart;
|
||||
|
||||
typedef struct _XmLTreeConstraintRec
|
||||
{
|
||||
XmManagerConstraintPart manager;
|
||||
XmLGridConstraintPart grid;
|
||||
XmLTreeConstraintPart tree;
|
||||
} XmLTreeConstraintRec, *XmLTreeConstraintPtr;
|
||||
|
||||
#endif
|
||||
1548
mozilla/cmd/xfe/Microline3.0/XmL/XmL.c
Normal file
1548
mozilla/cmd/xfe/Microline3.0/XmL/XmL.c
Normal file
File diff suppressed because it is too large
Load Diff
658
mozilla/cmd/xfe/Microline3.0/XmL/XmL.h
Normal file
658
mozilla/cmd/xfe/Microline3.0/XmL/XmL.h
Normal file
@@ -0,0 +1,658 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef XmLH
|
||||
#define XmLH
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
#define XmL_CPP 1
|
||||
#endif
|
||||
|
||||
#if defined(_STDC_) || defined(__STDC__) || defined(XmL_CPP)
|
||||
#ifndef _NO_PROTO
|
||||
#define XmL_ANSIC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define XmLVERSION_301
|
||||
|
||||
#ifdef XmL_CPP
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* shared resources */
|
||||
|
||||
#define XmNautoSelect "autoSelect"
|
||||
#define XmCAutoSelect "AutoSelect"
|
||||
#define XmNblankBackground "blankBackground"
|
||||
#define XmCBlankBackground "BlankBackground"
|
||||
#define XmNdebugLevel "debugLevel"
|
||||
#define XmCDebugLevel "DebugLevel"
|
||||
|
||||
/* Folder resources */
|
||||
|
||||
#define XmNacceptResize "acceptResize"
|
||||
#define XmCAcceptResize "AcceptResize"
|
||||
#define XmNactiveTab "activeTab"
|
||||
#define XmCActiveTab "ActiveTab"
|
||||
#define XmNblankBackgroundPixmap "blankBackgroundPixmap"
|
||||
#define XmCBlankBackgroundPixmap "BlankBackgroundPixmap"
|
||||
#define XmNcornerDimension "cornerDimension"
|
||||
#define XmCCornerDimension "CornerDimension"
|
||||
#define XmNcornerStyle "cornerStyle"
|
||||
#define XmCCornerStyle "CornerStyle"
|
||||
#define XmRCornerStyle "CornerStyle"
|
||||
#define XmNinactiveBackground "inactiveBackground"
|
||||
#define XmCInactiveBackground "InactiveBackground"
|
||||
#define XmNinactiveForeground "inactiveForeground"
|
||||
#define XmCInactiveForeground "InactiveForeground"
|
||||
#define XmNpixmapMargin "pixmapMargin"
|
||||
#define XmCPixmapMargin "PixmapMargin"
|
||||
#define XmCFolderResizePolicy "FolderResizePolicy"
|
||||
#define XmRFolderResizePolicy "FolderResizePolicy"
|
||||
#define XmNrotateWhenLeftRight "rotateWhenLeftRight"
|
||||
#define XmCRotateWhenLeftRight "RotateWhenLeftRight"
|
||||
#define XmNtabBarHeight "tabBarHeight"
|
||||
#define XmCTabBarHeight "TabBarHeight"
|
||||
#define XmNtabCount "tabCount"
|
||||
#define XmCTabCount "TabCount"
|
||||
#define XmNtabPlacement "tabPlacement"
|
||||
#define XmCTabPlacement "TabPlacement"
|
||||
#define XmRTabPlacement "TabPlacement"
|
||||
#define XmNtabsPerRow "tabsPerRow"
|
||||
#define XmCTabsPerRow "TabsPerRow"
|
||||
#define XmNtabTranslations "tabTranslations"
|
||||
#define XmNtabWidgetList "tabWidgetList"
|
||||
#define XmNtabWidgetClass "tabWidgetClass"
|
||||
#define XmCTabWidgetClass "TabWidgetClass"
|
||||
|
||||
/* Folder Constraint resources */
|
||||
|
||||
#define XmNtabFreePixmaps "tabFreePixmaps"
|
||||
#define XmCTabFreePixmaps "TabFreePixmaps"
|
||||
#define XmNtabInactivePixmap "tabInactivePixmap"
|
||||
#define XmCTabInactivePixmap "TabInactivePixmap"
|
||||
#define XmNtabManagedName "tabManagedName"
|
||||
#define XmCTabManagedName "TabManagedName"
|
||||
#define XmNtabManagedWidget "tabManagedWidget"
|
||||
#define XmCTabManagedWidget "TabManagedWidget"
|
||||
#define XmNtabPixmap "tabPixmap"
|
||||
#define XmCTabPixmap "TabPixmap"
|
||||
|
||||
/* Folder callbacks */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int reason;
|
||||
XEvent *event;
|
||||
int pos;
|
||||
int allowActivate;
|
||||
int layoutNeeded;
|
||||
} XmLFolderCallbackStruct;
|
||||
|
||||
/* Folder defines */
|
||||
|
||||
#define XmCORNER_NONE 0
|
||||
#define XmCORNER_LINE 1
|
||||
#define XmCORNER_ARC 2
|
||||
|
||||
#define XmFOLDER_TOP 0
|
||||
#define XmFOLDER_LEFT 1
|
||||
#define XmFOLDER_BOTTOM 2
|
||||
#define XmFOLDER_RIGHT 3
|
||||
|
||||
#define XmRESIZE_STATIC 10
|
||||
#define XmRESIZE_DYNAMIC 11
|
||||
|
||||
/* Grid resources */
|
||||
|
||||
#define XmNaddCallback "addCallback"
|
||||
#define XmNallowColumnHide "allowColumnHide"
|
||||
#define XmCAllowColumnHide "AllowColumnHide"
|
||||
#define XmNallowColumnResize "allowColumnResize"
|
||||
#define XmCAllowColumnResize "AllowColumnResize"
|
||||
#define XmNallowDragSelected "allowDragSelected"
|
||||
#define XmCAllowDragSelected "AllowDragSelected"
|
||||
#define XmNallowDrop "allowDrop"
|
||||
#define XmCAllowDrop "AllowDrop"
|
||||
#define XmNallowRowHide "allowRowHide"
|
||||
#define XmCAllowRowHide "AllowRowHide"
|
||||
#define XmNallowRowResize "allowRowResize"
|
||||
#define XmCAllowRowResize "AllowRowResize"
|
||||
#define XmNbottomFixedCount "bottomFixedCount"
|
||||
#define XmCBottomFixedCount "BottomFixedCount"
|
||||
#define XmNbottomFixedMargin "bottomFixedMargin"
|
||||
#define XmCBottomFixedMargin "BottomFixedMargin"
|
||||
#define XmNcellDefaults "cellDefaults"
|
||||
#define XmCCellDefaults "CellDefaults"
|
||||
#define XmNcellDrawCallback "cellDrawCallback"
|
||||
#define XmNcellDropCallback "cellDropCallback"
|
||||
#define XmNcellFocusCallback "cellFocusCallback"
|
||||
#define XmNcellPasteCallback "cellPasteCallback"
|
||||
#define XmNdeleteCallback "deleteCallback"
|
||||
#define XmNdeselectCallback "deselectCallback"
|
||||
#define XmNeditCallback "editCallback"
|
||||
#define XmNeditTranslations "editTranslations"
|
||||
#define XmNfooterColumns "footerColumns"
|
||||
#define XmCFooterColumns "FooterColumns"
|
||||
#define XmNfooterRows "footerRows"
|
||||
#define XmCFooterRows "FooterRows"
|
||||
#define XmNglobalPixmapHeight "globalPixmapHeight"
|
||||
#define XmCGlobalPixmapHeight "GlobalPixmapHeight"
|
||||
#define XmNglobalPixmapWidth "globalPixmapWidth"
|
||||
#define XmCGlobalPixmapWidth "GlobalPixmapWidth"
|
||||
#define XmCGridSelectionPolicy "GridSelectionPolicy"
|
||||
#define XmRGridSelectionPolicy "GridSelectionPolicy"
|
||||
#define XmRGridSizePolicy "GridSizePolicy"
|
||||
#define XmNheadingColumns "headingColumns"
|
||||
#define XmCHeadingColumns "HeadingColumns"
|
||||
#define XmNheadingRows "headingRows"
|
||||
#define XmCHeadingRows "HeadingRows"
|
||||
#define XmNhiddenColumns "hiddenColumns"
|
||||
#define XmCHiddenColumns "HiddenColumns"
|
||||
#define XmNhiddenRows "hiddenRows"
|
||||
#define XmCHiddenRows "HiddenRows"
|
||||
#define XmNhighlightRowMode "highlightRowMode"
|
||||
#define XmCHighlightRowMode "HighlightRowMode"
|
||||
#define XmNhorizontalSizePolicy "horizontalSizePolicy"
|
||||
#define XmCHorizontalSizePolicy "HorizontalSizePolicy"
|
||||
#define XmNhsbDisplayPolicy "hsbDisplayPolicy"
|
||||
#define XmCHsbDisplayPolicy "HsbDisplayPolicy"
|
||||
#define XmNimmediateDraw "immediateDraw"
|
||||
#define XmCImmediateDraw "ImmediateDraw"
|
||||
#define XmNlayoutFrozen "layoutFrozen"
|
||||
#define XmCLayoutFrozen "LayoutFrozen"
|
||||
#define XmNleftFixedCount "leftFixedCount"
|
||||
#define XmCLeftFixedCount "LeftFixedCount"
|
||||
#define XmNleftFixedMargin "leftFixedMargin"
|
||||
#define XmCLeftFixedMargin "LeftFixedMargin"
|
||||
#define XmNrightFixedCount "rightFixedCount"
|
||||
#define XmCRightFixedCount "RightFixedCount"
|
||||
#define XmNrightFixedMargin "rightFixedMargin"
|
||||
#define XmCRightFixedMargin "RightFixedMargin"
|
||||
#define XmNscrollBarMargin "scrollBarMargin"
|
||||
#define XmCScrollBarMargin "ScrollBarMargin"
|
||||
#define XmNscrollCallback "scrollCallback"
|
||||
#define XmNscrollColumn "scrollColumn"
|
||||
#define XmCScrollColumn "ScrollColumn"
|
||||
#define XmNscrollRow "scrollRow"
|
||||
#define XmCScrollRow "ScrollRow"
|
||||
#define XmNsimpleHeadings "simpleHeadings"
|
||||
#define XmCSimpleHeadings "SimpleHeadings"
|
||||
#define XmNsimpleWidths "simpleWidths"
|
||||
#define XmCSimpleWidths "SimpleWidths"
|
||||
#define XmNselectCallback "selectCallback"
|
||||
#define XmNselectForeground "selectForeground"
|
||||
#define XmCSelectForeground "SelectForeground"
|
||||
#define XmNselectBackground "selectBackground"
|
||||
#define XmCSelectBackground "SelectBackground"
|
||||
#define XmNshadowRegions "shadowRegions"
|
||||
#define XmCShadowRegions "ShadowRegions"
|
||||
#define XmNtextWidget "textWidget"
|
||||
#define XmCTextWidget "TextWidget"
|
||||
#define XmNtoggleTopColor "toggleTopColor"
|
||||
#define XmCToggleTopColor "ToggleTopColor"
|
||||
#define XmNtoggleBottomColor "toggleBottomColor"
|
||||
#define XmCToggleBottomColor "ToggleBottomColor"
|
||||
#define XmNtoggleSize "toggleSize"
|
||||
#define XmCToggleSize "ToggleSize"
|
||||
#define XmNtopFixedCount "topFixedCount"
|
||||
#define XmCTopFixedCount "TopFixedCount"
|
||||
#define XmNtopFixedMargin "topFixedMargin"
|
||||
#define XmCTopFixedMargin "TopFixedMargin"
|
||||
#define XmNtraverseTranslations "traverseTranslations"
|
||||
#define XmNuseAverageFontWidth "useAverageFontWidth"
|
||||
#define XmCUseAverageFontWidth "UseAverageFontWidth"
|
||||
#define XmNverticalSizePolicy "verticalSizePolicy"
|
||||
#define XmCVerticalSizePolicy "VerticalSizePolicy"
|
||||
#define XmNvisibleColumns "visibleColumns"
|
||||
#define XmCVisibleColumns "VisibleColumns"
|
||||
#define XmNvisibleRows "visibleRows"
|
||||
#define XmCVisibleRows "VisibleRows"
|
||||
#define XmNvsbDisplayPolicy "vsbDisplayPolicy"
|
||||
#define XmCVsbDisplayPolicy "VsbDisplayPolicy"
|
||||
#define XmNiconSpacing "iconSpacing"
|
||||
#define XmCIconSpacing "IconSpacing"
|
||||
|
||||
|
||||
/* XFE Additions */
|
||||
#define XmNhideUnhideButtons "hideUnhideButtons"
|
||||
#define XmCHideUnhideButtons "HideUnhideButtons"
|
||||
#define XmNsingleClickActivation "singleClickActivation"
|
||||
#define XmCSingleClickActivation "SingleClickActivation"
|
||||
#define XmNuseTextWidget "useTextWidget"
|
||||
#define XmCUseTextWidget "UseTextWidget"
|
||||
#define XmNcolumnSortType "columnSortType"
|
||||
#define XmCColumnSortType "ColumnSortType"
|
||||
#define XmRColumnSortType "ColumnSortType"
|
||||
#if 0
|
||||
#define XmNhideButtonTranslations "hideButtonTranslations"
|
||||
#define XmNunhideButtonTranslations "unhideButtonTranslations"
|
||||
#endif /*0*/
|
||||
#define XmNminColumnWidth "minColumnWidth"
|
||||
#define XmCMinColumnWidth "MinColumnWidth"
|
||||
|
||||
#define XmNenterCellCallback "enterCellCallback"
|
||||
#define XmNleaveCellCallback "leaveCellCallback"
|
||||
|
||||
#define XmNenterGridCallback "enterGridCallback"
|
||||
#define XmNleaveGridCallback "leaveGridCallback"
|
||||
|
||||
/* Grid Row/Column/Cell resources */
|
||||
|
||||
#define XmNrow "row"
|
||||
#define XmCGridRow "row"
|
||||
#define XmNrowHeight "rowHeight"
|
||||
#define XmCRowHeight "RowHeight"
|
||||
#define XmNrowPtr "rowPtr"
|
||||
#define XmNrowRangeEnd "rowRangeEnd"
|
||||
#define XmCRowRangeEnd "RowRangeEnd"
|
||||
#define XmNrowRangeStart "rowRangeStart"
|
||||
#define XmCRowRangeStart "RowRangeStart"
|
||||
#define XmNrowSizePolicy "rowSizePolicy"
|
||||
#define XmCRowSizePolicy "RowSizePolicy"
|
||||
#define XmNrowStep "rowStep"
|
||||
#define XmCRowStep "RowStep"
|
||||
#define XmNrowType "rowType"
|
||||
#define XmCRowType "RowType"
|
||||
#define XmRRowType "RowType"
|
||||
#define XmNrowUserData "rowUserData"
|
||||
|
||||
#define XmNcolumn "column"
|
||||
#define XmCGridColumn "Column"
|
||||
#define XmNcolumnPtr "columnPtr"
|
||||
#define XmNcolumnRangeEnd "columnRangeEnd"
|
||||
#define XmCColumnRangeEnd "ColumnRangeEnd"
|
||||
#define XmNcolumnRangeStart "columnRangeStart"
|
||||
#define XmCColumnRangeStart "ColumnRangeStart"
|
||||
#define XmNcolumnResizable "columnResizable"
|
||||
#define XmCColumnResizable "ColumnResizable"
|
||||
#define XmNcolumnSizePolicy "columnSizePolicy"
|
||||
#define XmCColumnSizePolicy "ColumnSizePolicy"
|
||||
#define XmNcolumnHidden "columnHidden"
|
||||
#define XmCColumnHidden "ColumnHidden"
|
||||
#define XmNcolumnStep "columnStep"
|
||||
#define XmCColumnStep "ColumnStep"
|
||||
#define XmNcolumnType "columnType"
|
||||
#define XmCColumnType "ColumnType"
|
||||
#define XmRColumnType "ColumnType"
|
||||
#define XmNcolumnWidth "columnWidth"
|
||||
#define XmCColumnWidth "ColumnWidth"
|
||||
#define XmNcolumnUserData "columnUserData"
|
||||
|
||||
#define XmNcellAlignment "cellAlignment"
|
||||
#define XmCCellAlignment "CellAlignment"
|
||||
#define XmRCellAlignment "CellAlignment"
|
||||
#define XmNcellBackground "cellBackground"
|
||||
#define XmCCellBackground "CellBackground"
|
||||
#define XmRCellBorderType "CellBorderType"
|
||||
#define XmNcellBottomBorderType "cellBottomBorderType"
|
||||
#define XmCCellBottomBorderType "CellBottomBorderType"
|
||||
#define XmNcellBottomBorderColor "cellBottomBorderColor"
|
||||
#define XmCCellBottomBorderColor "CellBottomBorderColor"
|
||||
#define XmNcellColumnSpan "cellColumnSpan"
|
||||
#define XmCCellColumnSpan "CellColumnSpan"
|
||||
#define XmNcellEditable "cellEditable"
|
||||
#define XmCCellEditable "CellEditable"
|
||||
#define XmNcellForeground "cellForeground"
|
||||
#define XmCCellForeground "CellForeground"
|
||||
#define XmNcellFontList "cellFontList"
|
||||
#define XmCCellFontList "CellFontList"
|
||||
#define XmNcellLeftBorderType "cellLeftBorderType"
|
||||
#define XmCCellLeftBorderType "CellLeftBorderType"
|
||||
#define XmNcellLeftBorderColor "cellLeftBorderColor"
|
||||
#define XmCCellLeftBorderColor "CellLeftBorderColor"
|
||||
#define XmNcellMarginBottom "cellMarginBottom"
|
||||
#define XmCCellMarginBottom "CellMarginBottom"
|
||||
#define XmNcellMarginLeft "cellMarginLeft"
|
||||
#define XmCCellMarginLeft "CellMarginLeft"
|
||||
#define XmNcellMarginRight "cellMarginRight"
|
||||
#define XmCCellMarginRight "CellMarginRight"
|
||||
#define XmNcellMarginTop "cellMarginTop"
|
||||
#define XmCCellMarginTop "CellMarginTop"
|
||||
#define XmNcellPixmap "cellPixmap"
|
||||
#define XmCCellPixmap "CellPixmap"
|
||||
#define XmNcellPixmapMask "cellPixmapMask"
|
||||
#define XmCCellPixmapMask "CellPixmapMask"
|
||||
#define XmNcellRightBorderType "cellRightBorderType"
|
||||
#define XmCCellRightBorderType "CellRightBorderType"
|
||||
#define XmNcellRightBorderColor "cellRightBorderColor"
|
||||
#define XmCCellRightBorderColor "CellRightBorderColor"
|
||||
#define XmNcellRowSpan "cellRowSpan"
|
||||
#define XmCCellRowSpan "CellRowSpan"
|
||||
#define XmNcellString "cellString"
|
||||
#define XmNcellToggleSet "cellToggleSet"
|
||||
#define XmCCellToggleSet "CellToggleSet"
|
||||
#define XmNcellTopBorderType "cellTopBorderType"
|
||||
#define XmCCellTopBorderType "CellTopBorderType"
|
||||
#define XmNcellTopBorderColor "cellTopBorderColor"
|
||||
#define XmCCellTopBorderColor "CellTopBorderColor"
|
||||
#define XmNcellType "cellType"
|
||||
#define XmCCellType "CellType"
|
||||
#define XmRCellType "CellType"
|
||||
#define XmNcellUserData "cellUserData"
|
||||
|
||||
/* Grid callbacks */
|
||||
|
||||
typedef struct _XmLGridDrawStruct
|
||||
{
|
||||
GC gc;
|
||||
XRectangle *cellRect;
|
||||
Dimension topMargin;
|
||||
Dimension bottomMargin;
|
||||
Dimension leftMargin;
|
||||
Dimension rightMargin;
|
||||
Pixel foreground;
|
||||
Pixel background;
|
||||
Pixel selectForeground;
|
||||
Pixel selectBackground;
|
||||
XmFontList fontList;
|
||||
unsigned char alignment;
|
||||
Boolean drawSelected;
|
||||
int drawFocusType;
|
||||
XmStringDirection stringDirection;
|
||||
} XmLGridDrawStruct;
|
||||
|
||||
typedef struct _XmLGridCallbackStruct
|
||||
{
|
||||
int reason;
|
||||
XEvent *event;
|
||||
unsigned char rowType, columnType;
|
||||
int row, column;
|
||||
XRectangle *clipRect;
|
||||
XmLGridDrawStruct *drawInfo;
|
||||
void *object;
|
||||
} XmLGridCallbackStruct;
|
||||
|
||||
#define XmCR_ADD_ROW 900
|
||||
#define XmCR_ADD_COLUMN 901
|
||||
#define XmCR_ADD_CELL 902
|
||||
#define XmCR_CELL_DRAW 903
|
||||
#define XmCR_CELL_DROP 904
|
||||
#define XmCR_CELL_FOCUS_IN 905
|
||||
#define XmCR_CELL_FOCUS_OUT 906
|
||||
#define XmCR_CELL_PASTE 907
|
||||
#define XmCR_CONF_TEXT 908
|
||||
#define XmCR_PREF_WIDTH 909
|
||||
#define XmCR_DELETE_ROW 910
|
||||
#define XmCR_DELETE_COLUMN 911
|
||||
#define XmCR_DELETE_CELL 912
|
||||
#define XmCR_EDIT_BEGIN 913
|
||||
#define XmCR_EDIT_INSERT 914
|
||||
#define XmCR_EDIT_CANCEL 915
|
||||
#define XmCR_EDIT_COMPLETE 916
|
||||
#define XmCR_FREE_VALUE 917
|
||||
#define XmCR_RESIZE_ROW 918
|
||||
#define XmCR_RESIZE_COLUMN 919
|
||||
#define XmCR_PREF_HEIGHT 920
|
||||
#define XmCR_SCROLL_ROW 921
|
||||
#define XmCR_SCROLL_COLUMN 922
|
||||
#define XmCR_SELECT_CELL 923
|
||||
#define XmCR_SELECT_COLUMN 924
|
||||
#define XmCR_SELECT_ROW 925
|
||||
#define XmCR_DESELECT_CELL 926
|
||||
#define XmCR_DESELECT_COLUMN 927
|
||||
#define XmCR_DESELECT_ROW 928
|
||||
|
||||
/* xfe added callback reason */
|
||||
#define XmCR_RESIZE_GRID 929
|
||||
#define XmCR_SHOW_POPUP 930
|
||||
#define XmCR_SINGLECLICK 931
|
||||
|
||||
#define XmCR_ENTER_CELL 931
|
||||
#define XmCR_ENTER_GRID 932
|
||||
#define XmCR_LEAVE_CELL 933
|
||||
#define XmCR_LEAVE_GRID 934
|
||||
|
||||
/* Grid defines */
|
||||
|
||||
#define XmCONTENT 0
|
||||
#define XmHEADING 1
|
||||
#define XmFOOTER 2
|
||||
#define XmALL_TYPES 3
|
||||
#define XmINVALID_TYPE 4
|
||||
|
||||
#define XmICON_CELL 0
|
||||
#define XmPIXMAP_CELL 1
|
||||
#define XmSTRING_CELL 2
|
||||
|
||||
#define XmBORDER_NONE 0
|
||||
#define XmBORDER_LINE 1
|
||||
#define XmBORDER_DASH 2
|
||||
|
||||
#define XmFORMAT_DELIMITED 1
|
||||
#define XmFORMAT_XL 2
|
||||
#define XmFORMAT_PAD 3
|
||||
#define XmFORMAT_PASTE 4
|
||||
#define XmFORMAT_DROP 5
|
||||
|
||||
#define XmSELECT_NONE 1
|
||||
#define XmSELECT_SINGLE_ROW 2
|
||||
#define XmSELECT_BROWSE_ROW 3
|
||||
#define XmSELECT_MULTIPLE_ROW 4
|
||||
#define XmSELECT_CELL 5
|
||||
|
||||
#define XmDRAW_FOCUS_NONE 1
|
||||
#define XmDRAW_FOCUS_CELL 2
|
||||
#define XmDRAW_FOCUS_LEFT 3
|
||||
#define XmDRAW_FOCUS_MID 4
|
||||
#define XmDRAW_FOCUS_RIGHT 5
|
||||
|
||||
#define XmTRAVERSE_EXTEND_DOWN 20
|
||||
#define XmTRAVERSE_EXTEND_LEFT 21
|
||||
#define XmTRAVERSE_EXTEND_RIGHT 22
|
||||
#define XmTRAVERSE_EXTEND_UP 23
|
||||
#define XmTRAVERSE_PAGE_DOWN 24
|
||||
#define XmTRAVERSE_PAGE_LEFT 25
|
||||
#define XmTRAVERSE_PAGE_RIGHT 26
|
||||
#define XmTRAVERSE_PAGE_UP 27
|
||||
#define XmTRAVERSE_TO_BOTTOM 28
|
||||
#define XmTRAVERSE_TO_TOP 29
|
||||
|
||||
#define XmALIGNMENT_LEFT 0
|
||||
#ifndef XmALIGNMENT_CENTER
|
||||
#define XmALIGNMENT_CENTER 1
|
||||
#endif
|
||||
#define XmALIGNMENT_RIGHT 2
|
||||
#define XmALIGNMENT_TOP_LEFT 3
|
||||
#define XmALIGNMENT_TOP 4
|
||||
#define XmALIGNMENT_TOP_RIGHT 5
|
||||
#define XmALIGNMENT_BOTTOM_LEFT 6
|
||||
#define XmALIGNMENT_BOTTOM 7
|
||||
#define XmALIGNMENT_BOTTOM_RIGHT 8
|
||||
|
||||
/* xfe additions */
|
||||
#define XmSORT_NONE 0
|
||||
#define XmSORT_ASCENDING 1
|
||||
#define XmSORT_DESCENDING 2
|
||||
|
||||
/* Progress resources */
|
||||
|
||||
#define XmNcompleteValue "completeValue"
|
||||
#define XmCCompleteValue "CompleteValue"
|
||||
#define XmNnumBoxes "numBoxes"
|
||||
#define XmCNumBoxes "NumBoxes"
|
||||
#define XmNmeterStyle "meterStyle"
|
||||
#define XmCMeterStyle "MeterStyle"
|
||||
#define XmRMeterStyle "MeterStyle"
|
||||
#define XmNshowPercentage "showPercentage"
|
||||
#define XmCShowPercentage "ShowPercentage"
|
||||
#define XmNshowTime "showTime"
|
||||
#define XmCShowTime "ShowTime"
|
||||
|
||||
/* Progress defines */
|
||||
|
||||
#define XmMETER_BAR 0
|
||||
#define XmMETER_BOXES 1
|
||||
|
||||
/* Tree resources */
|
||||
|
||||
#define XmNcollapseCallback "collapseCallback"
|
||||
#define XmNconnectingLineColor "connectingLineColor"
|
||||
#define XmCConnectingLineColor "ConnectingLineColor"
|
||||
#define XmNexpandCallback "expandCallback"
|
||||
#define XmNlevelSpacing "levelSpacing"
|
||||
#define XmCLevelSpacing "LevelSpacing"
|
||||
#define XmNplusMinusColor "plusMinusColor"
|
||||
#define XmCPlusMinusColor "PlusMinusColor"
|
||||
#define XmNrowExpands "rowExpands"
|
||||
#define XmCRowExpands "RowExpands"
|
||||
#define XmNrowIsExpanded "rowIsExpanded"
|
||||
#define XmCRowIsExpanded "RowIsExpanded"
|
||||
#define XmNrowLevel "rowLevel"
|
||||
#define XmCRowLevel "RowLevel"
|
||||
#define XmNignorePixmaps "ignorePixmaps"
|
||||
#define XmCIgnorePixmaps "IgnorePixmaps"
|
||||
|
||||
/* Tree callbacks */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int level;
|
||||
Boolean expands;
|
||||
Boolean isExpanded;
|
||||
Pixmap pixmap, pixmask;
|
||||
XmString string;
|
||||
} XmLTreeRowDefinition;
|
||||
|
||||
#define XmCR_COLLAPSE_ROW 950
|
||||
#define XmCR_EXPAND_ROW 951
|
||||
|
||||
/* Backwards compatibility */
|
||||
|
||||
#ifdef XmLBACKWARDS_COMPATIBILITY
|
||||
|
||||
#define XmNfooterColumnCount "footerColumns"
|
||||
#define XmNfooterRowCount "footerRows"
|
||||
#define XmNheadingColumnCount "headingColumns"
|
||||
#define XmNheadingRowCount "headingRows"
|
||||
#define XmNcellBottomBorderPixel "cellBottomBorderColor"
|
||||
#define XmCCellBottomBorderPixel "CellBottomBorderColor"
|
||||
#define XmNcellLeftBorderPixel "cellLeftBorderColor"
|
||||
#define XmCCellLeftBorderPixel "CellLeftBorderColor"
|
||||
#define XmNcellRightBorderPixel "cellRightBorderColor"
|
||||
#define XmCCellRightBorderPixel "CellRightBorderColor"
|
||||
#define XmNcellTopBorderPixel "cellTopBorderColor"
|
||||
#define XmCCellTopBorderPixel "CellTopBorderColor"
|
||||
|
||||
#define XmTEXT_CELL 250
|
||||
#define XmLABEL_CELL 251
|
||||
|
||||
typedef void XmLCGridRow;
|
||||
typedef void XmLCGridColumn;
|
||||
typedef void XmLCGridCell;
|
||||
|
||||
#endif
|
||||
|
||||
/* Utility defines */
|
||||
|
||||
#define XmDRAWNB_ARROW 0
|
||||
#define XmDRAWNB_ARROWLINE 1
|
||||
#define XmDRAWNB_DOUBLEARROW 2
|
||||
#define XmDRAWNB_SQUARE 3
|
||||
#define XmDRAWNB_DOUBLEBAR 4
|
||||
#define XmDRAWNB_STRING 5
|
||||
#define XmDRAWNB_SMALLARROW 6
|
||||
|
||||
#define XmDRAWNB_RIGHT 0
|
||||
#define XmDRAWNB_LEFT 1
|
||||
#define XmDRAWNB_UP 2
|
||||
#define XmDRAWNB_DOWN 3
|
||||
|
||||
#define XmSTRING_RIGHT 0
|
||||
#define XmSTRING_LEFT 1
|
||||
#define XmSTRING_UP 2
|
||||
#define XmSTRING_DOWN 3
|
||||
|
||||
enum { XmLRectInside, XmLRectOutside, XmLRectPartial };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int pos;
|
||||
} XmLArrayItem;
|
||||
|
||||
typedef struct _XmLArrayRec *XmLArray;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
unsigned char value;
|
||||
} XmLStringToUCharMap;
|
||||
|
||||
/* Utility functions */
|
||||
|
||||
typedef int (*XmLSortCompareFunc)(void *userData, void *l, void *r);
|
||||
typedef int (*XmLArrayCompareFunc)(void *, void **, void **);
|
||||
|
||||
XmLArray XmLArrayNew(char autonumber, char growFast);
|
||||
void XmLArrayFree(XmLArray array);
|
||||
void XmLArrayAdd(XmLArray array, int pos, int count);
|
||||
int XmLArrayDel(XmLArray array, int pos, int count);
|
||||
int XmLArraySet(XmLArray array, int pos, void *item);
|
||||
void *XmLArrayGet(XmLArray array, int pos);
|
||||
int XmLArrayGetCount(XmLArray array);
|
||||
int XmLArrayMove(XmLArray array, int newPos, int pos, int count);
|
||||
int XmLArrayReorder(XmLArray array, int *newPositions,
|
||||
int pos, int count);
|
||||
int XmLArraySort(XmLArray array, XmLArrayCompareFunc compare,
|
||||
void *userData, int pos, int count);
|
||||
Boolean XmLCvtStringToUChar(Display *dpy, char *resname,
|
||||
XmLStringToUCharMap *map, XrmValuePtr fromVal, XrmValuePtr toVal);
|
||||
int XmLDateDaysInMonth(int m, int y);
|
||||
int XmLDateWeekDay(int m, int d, int y);
|
||||
void XmLDrawnButtonSetType(Widget w, int drawnType, int drawnDir);
|
||||
void XmLDrawToggle(Widget w, Boolean state, Dimension size,
|
||||
unsigned char alignment, GC gc, Pixel backgroundColor,
|
||||
Pixel topColor, Pixel bottomColor, Pixel checkColor,
|
||||
XRectangle *rect, XRectangle *clipRect);
|
||||
XmFontList XmLFontListCopyDefault(Widget widget);
|
||||
void XmLFontListGetDimensions(XmFontList fontList, short *width,
|
||||
short *height, Boolean useAverageWidth);
|
||||
void XmLInitialize(void);
|
||||
int XmLMessageBox(Widget w, char *string, Boolean okOnly);
|
||||
void XmLPixmapDraw(Widget w, Pixmap pixmap, Pixmap pixmask,
|
||||
int pixmapWidth, int pixmapHeight, unsigned char alignment,
|
||||
GC gc, XRectangle *rect, XRectangle *clipRect);
|
||||
int XmLRectIntersect(XRectangle *r1, XRectangle *r2);
|
||||
Widget XmLShellOfWidget(Widget w);
|
||||
void XmLSort(void *base, int numItems, unsigned int itemSize,
|
||||
XmLSortCompareFunc, void *userData);
|
||||
void XmLStringDraw(Widget w, XmString string, XmStringDirection stringDir,
|
||||
XmFontList fontList, unsigned char alignment, GC gc,
|
||||
XRectangle *rect, XRectangle *clipRect);
|
||||
void XmLStringDrawDirection(Display *dpy, Window win, XmFontList fontlist,
|
||||
XmString string, GC gc, int x, int y, Dimension width,
|
||||
unsigned char alignment, unsigned char layout_direction,
|
||||
unsigned char drawing_direction);
|
||||
void XmLWarning(Widget w, char *msg);
|
||||
|
||||
#ifdef XmL_CPP
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
162
mozilla/cmd/xfe/Microline3.0/XmL/XmL.uih
Normal file
162
mozilla/cmd/xfe/Microline3.0/XmL/XmL.uih
Normal file
@@ -0,0 +1,162 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
! Common Resources
|
||||
|
||||
value
|
||||
XmNblankBackground : argument ('blankBackground', color);
|
||||
XmNautoSelect : argument ('autoSelect', boolean);
|
||||
XmNdebugLevel : argument ('debugLevel', integer);
|
||||
|
||||
! Folder Widget
|
||||
|
||||
procedure
|
||||
XmLCreateFolder();
|
||||
|
||||
! Folder Resources
|
||||
|
||||
value
|
||||
XmNcornerDimension : argument ('cornerDimension', integer);
|
||||
XmNcornerStyle : argument ('cornerStyle', integer);
|
||||
CornerNone : 0;
|
||||
CornerLine : 1;
|
||||
CornerArc : 2;
|
||||
XmNinactiveBackground : argument ('inactiveBackground', color);
|
||||
XmNinactiveForeground : argument ('inactiveForeground', color);
|
||||
XmNpixmapMargin : argument ('pixmapMargin', integer);
|
||||
ResizeStatic : 10;
|
||||
ResizeDynamic : 11;
|
||||
XmNrotateWhenLeftRight : argument ('rotateWhenRightLeft', boolean);
|
||||
XmNtabPlacement : argument ('tabPlacement', integer);
|
||||
FolderTop : 0;
|
||||
FolderLeft : 1;
|
||||
FolderBottom : 2;
|
||||
FolderRight : 3;
|
||||
XmNtabsPerRow : argument ('tabsPerRow', integer);
|
||||
|
||||
! Folder Constraint resources
|
||||
|
||||
XmNtabFreePixmaps : argument ('tabFreePixmaps', boolean);
|
||||
XmNtabManagedName : argument ('tabManagedName', string);
|
||||
XmNtabManagedWidget : argument ('tabManagedWidget', any);
|
||||
|
||||
! Grid Widget
|
||||
|
||||
procedure
|
||||
XmLCreateGrid();
|
||||
|
||||
! Grid Resources
|
||||
|
||||
value
|
||||
XmNallowColumnHide : argument ('allowColumnHide', boolean);
|
||||
XmNallowColumnResize : argument ('allowColumnResize', boolean);
|
||||
XmNallowDragSelected : argument ('allowDragSelected', boolean);
|
||||
XmNallowDrop : argument ('allowDrop', boolean);
|
||||
XmNallowRowHide : argument ('allowRowHide', boolean);
|
||||
XmNallowRowResize : argument ('allowRowResize', boolean);
|
||||
XmNbottomFixedCount : argument ('bottomFixedCount', integer);
|
||||
XmNbottomFixedMargin : argument ('bottomFixedMargin', integer);
|
||||
XmNfooterColumns : argument ('footerColumns', integer);
|
||||
XmNfooterRows : argument ('footerRows', integer);
|
||||
XmNglobalPixmapHeight : argument ('globalPixmapHeight', integer);
|
||||
XmNglobalPixmapWidth : argument ('globalPixmapWidth', integer);
|
||||
XmNheadingColumns : argument ('headingColumns', integer);
|
||||
XmNheadingRows : argument ('headingRows', integer);
|
||||
XmNhighlightRowMode : argument ('highlightRowMode', boolean);
|
||||
XmNhorizontalSizePolicy : argument ('horizontalSizePolicy', integer);
|
||||
XmNhsbDisplayPolicy : argument ('hsbDisplayPolicy', integer);
|
||||
XmNimmediateDraw : argument ('immediateDraw', boolean);
|
||||
XmNleftFixedCount : argument ('leftFixedCount', integer);
|
||||
XmNleftFixedMargin : argument ('leftFixedMargin', integer);
|
||||
XmNrightFixedCount : argument ('rightFixedCount', integer);
|
||||
XmNrightFixedMargin : argument ('rightFixedMargin', integer);
|
||||
XmNscrollBarMargin : argument ('scrollBarMargin', integer);
|
||||
SelectNone : 1;
|
||||
SelectSingleRow : 2;
|
||||
SelectBrowseRow : 3;
|
||||
SelectMultipleRow : 4;
|
||||
SelectCell : 5;
|
||||
XmNselectBackground : argument ('selectBackground', color);
|
||||
XmNselectForeground : argument ('selectForeground', color);
|
||||
XmNshadowRegions : argument ('shadowRegions', integer);
|
||||
XmNsimpleHeadings : argument ('simpleHeadings', string);
|
||||
XmNsimpleWidths : argument ('simpleWidths', string);
|
||||
XmNtopFixedCount : argument ('topFixedCount', integer);
|
||||
XmNtopFixedMargin : argument ('topFixedMargin', integer);
|
||||
XmNuseAverageFontWidth : argument ('useAverageFontWidth', boolean);
|
||||
XmNverticalSizePolicy : argument ('verticalSizePolicy', integer);
|
||||
XmNvisibleColumns : argument ('visibleColumns', integer);
|
||||
XmNvisibleRows : argument ('visibleRows', integer);
|
||||
XmNvsbDisplayPolicy : argument ('vsbDisplayPolicy', integer);
|
||||
|
||||
! Grid Callbacks
|
||||
|
||||
value
|
||||
XmNaddCallback : reason ('addCallback');
|
||||
XmNcellDrawCallback : reason ('cellDrawCallback');
|
||||
XmNcellDropCallback : reason ('cellDropCallback');
|
||||
XmNcellFocusCallback : reason ('cellFocusCallback');
|
||||
XmNcellPasteCallback : reason ('cellPasteCallback');
|
||||
XmNdeleteCallback : reason ('deleteCallback');
|
||||
XmNdeselectCallback : reason ('deselectCallback');
|
||||
XmNeditCallback : reason ('editCallback');
|
||||
XmNscrollCallback : reason ('scrollCallback');
|
||||
XmNselectCallback : reason ('selectCallback');
|
||||
|
||||
! Progress Widget
|
||||
|
||||
procedure
|
||||
XmLCreateProgress();
|
||||
|
||||
! Progress Resources
|
||||
|
||||
value
|
||||
XmNcompleteValue : argument ('completeValue', integer);
|
||||
XmNmeterStyle : argument ('meterStyle', integer);
|
||||
MeterBar : 0;
|
||||
MeterBoxes : 1;
|
||||
XmNnumBoxes : argument ('numBoxes', integer);
|
||||
XmNshowTime : argument ('showTime', boolean);
|
||||
XmNshowPercentage : argument ('showPercentage', boolean);
|
||||
|
||||
! Tree Widget
|
||||
|
||||
procedure
|
||||
XmLCreateTree();
|
||||
|
||||
! Tree Resources
|
||||
|
||||
value
|
||||
XmNconnectingLineColor : argument ('connectingLineColor', color);
|
||||
XmNlevelSpacing : argument ('levelSpacing', integer);
|
||||
XmNplusMinusColor : argument ('plusMinusColor', color);
|
||||
|
||||
! Tree Callbacks
|
||||
|
||||
value
|
||||
XmNexpandCallback : reason ('expandCallback');
|
||||
XmNcollapseCallback : reason ('collapseCallback');
|
||||
168
mozilla/cmd/xfe/Microline3.0/examples/Makefile
Normal file
168
mozilla/cmd/xfe/Microline3.0/examples/Makefile
Normal file
@@ -0,0 +1,168 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
#
|
||||
# This make file was copied from ns/cmd/xfe/XfeWidgets/tests/Makefile
|
||||
# and tweaked. A lot of the rules and logic can probably be shared.
|
||||
# Stuff should be shared in
|
||||
#
|
||||
#
|
||||
DEPTH = ../../../..
|
||||
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
UNUSED_CSRCS = \
|
||||
demo.c \
|
||||
prog1.c \
|
||||
prog2.c \
|
||||
prog3.c \
|
||||
uil1.c \
|
||||
util1.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
$(UNUSED_CSRCS) \
|
||||
folder1.c \
|
||||
folder2.c \
|
||||
folder3.c \
|
||||
folder4.c \
|
||||
grid1.c \
|
||||
grid2.c \
|
||||
grid3.c \
|
||||
grid4.c \
|
||||
grid5.c \
|
||||
grid6.c \
|
||||
tree1.c \
|
||||
tree2.c \
|
||||
tree3.c \
|
||||
tree4.c \
|
||||
tree5.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = \
|
||||
Microline
|
||||
|
||||
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.exe))
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
include $(DEPTH)/cmd/xfe/XfeWidgets/XfeWidgets.mk
|
||||
|
||||
all:: $(PROGS)
|
||||
install:: $(PROGS)
|
||||
|
||||
LDFLAGS =
|
||||
|
||||
SHARED_XFE_LIBS = $(DIST)/bin/libXmL.$(DLL_SUFFIX)
|
||||
|
||||
STATIC_XFE_LIBS = $(DIST)/lib/libXmL.a
|
||||
|
||||
DIST_FLAGS = -L$(DIST)/bin
|
||||
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
|
||||
XFE_FLAGS = $(STATIC_XFE_LIBS)
|
||||
|
||||
else
|
||||
|
||||
XFE_FLAGS = $(SHARED_XFE_LIBS)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
-include $(DEPTH)/config/motif.mk
|
||||
endif
|
||||
|
||||
XM_LD_FLAGS = -lMrm -lXm $(NS_MOTIF2_XP_LD_FLAGS)
|
||||
|
||||
X_LD_FLAGS = $(XM_LD_FLAGS) -lXt -lXmu -lXext -lX11
|
||||
|
||||
OS_BEFORE_FLAGS =
|
||||
OS_AFTER_FLAGS =
|
||||
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
|
||||
OS_BEFORE_LDFLAGS =\
|
||||
-L/usr/dt/lib \
|
||||
-L/usr/openwin/lib
|
||||
|
||||
OS_AFTER_LDFLAGS =\
|
||||
-lw \
|
||||
-lintl \
|
||||
-lsocket \
|
||||
-lnsl \
|
||||
-lgen \
|
||||
-lm \
|
||||
-ldl
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
|
||||
OS_BEFORE_LDFLAGS =\
|
||||
-L/usr/dt/lib
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
|
||||
OS_BEFORE_LDFLAGS = -L/usr/X11R6/lib
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),HP-UX)
|
||||
|
||||
OS_BEFORE_LDFLAGS = -L$(DIST)/bin
|
||||
|
||||
endif
|
||||
|
||||
LDFLAGS =\
|
||||
$(OS_BEFORE_LDFLAGS) \
|
||||
$(DIST_FLAGS) \
|
||||
$(XFE_FLAGS) \
|
||||
$(X_LD_FLAGS) \
|
||||
$(OS_AFTER_LDFLAGS)
|
||||
|
||||
##
|
||||
## Test dependancies
|
||||
##
|
||||
#OTHER_DEPS = Makefile $(XFE_FLAGS)
|
||||
OTHER_DEPS = $(XFE_FLAGS)
|
||||
|
||||
##
|
||||
## Resource source rule
|
||||
##
|
||||
#$(OBJDIR)/%.ad.c:: %.ad # Makefile
|
||||
# @$(MAKE_OBJDIR)
|
||||
# @echo 'char * fallback_resources[] = {' > $@; \
|
||||
# ./ad2c $< >> $@; \
|
||||
# echo '0};' >> $@
|
||||
|
||||
##
|
||||
## Resource object rule
|
||||
##
|
||||
#$(OBJDIR)/%.ad.o: $(OBJDIR)/%.ad.c
|
||||
# @$(MAKE_OBJDIR)
|
||||
# $(CC) -o $@ -c $<
|
||||
|
||||
##
|
||||
## Binary link rule
|
||||
##
|
||||
$(OBJDIR)/%.exe: $(OBJDIR)/%.o $(OTHER_DEPS)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(XFE_PURIFY) $(CC) -o $@ $< $(LDFLAGS)
|
||||
173
mozilla/cmd/xfe/Microline3.0/examples/Makefile.in
Normal file
173
mozilla/cmd/xfe/Microline3.0/examples/Makefile.in
Normal file
@@ -0,0 +1,173 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
#
|
||||
# This make file was copied from ns/cmd/xfe/XfeWidgets/tests/Makefile
|
||||
# and tweaked. A lot of the rules and logic can probably be shared.
|
||||
# Stuff should be shared in
|
||||
#
|
||||
#
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
UNUSED_CSRCS = \
|
||||
demo.c \
|
||||
prog1.c \
|
||||
prog2.c \
|
||||
prog3.c \
|
||||
uil1.c \
|
||||
util1.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
$(UNUSED_CSRCS) \
|
||||
folder1.c \
|
||||
folder2.c \
|
||||
folder3.c \
|
||||
folder4.c \
|
||||
grid1.c \
|
||||
grid2.c \
|
||||
grid3.c \
|
||||
grid4.c \
|
||||
grid5.c \
|
||||
grid6.c \
|
||||
tree1.c \
|
||||
tree2.c \
|
||||
tree3.c \
|
||||
tree4.c \
|
||||
tree5.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = \
|
||||
Microline
|
||||
|
||||
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.exe))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
include $(topsrcdir)/cmd/xfe/XfeWidgets/XfeWidgets.mk
|
||||
|
||||
all:: $(PROGS)
|
||||
install:: $(PROGS)
|
||||
|
||||
LDFLAGS =
|
||||
|
||||
SHARED_XFE_LIBS = $(DIST)/bin/libXmL.$(DLL_SUFFIX)
|
||||
|
||||
STATIC_XFE_LIBS = $(DIST)/lib/libXmL.a
|
||||
|
||||
DIST_FLAGS = -L$(DIST)/bin
|
||||
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
|
||||
XFE_FLAGS = $(STATIC_XFE_LIBS)
|
||||
|
||||
else
|
||||
|
||||
XFE_FLAGS = $(SHARED_XFE_LIBS)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
-include $(DEPTH)/config/motif.mk
|
||||
endif
|
||||
|
||||
XM_LD_FLAGS = -lMrm -lXm $(NS_MOTIF2_XP_LD_FLAGS)
|
||||
|
||||
X_LD_FLAGS = $(XM_LD_FLAGS) -lXt -lXmu -lXext -lX11
|
||||
|
||||
OS_BEFORE_FLAGS =
|
||||
OS_AFTER_FLAGS =
|
||||
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
|
||||
OS_BEFORE_LDFLAGS =\
|
||||
-L/usr/dt/lib \
|
||||
-L/usr/openwin/lib
|
||||
|
||||
OS_AFTER_LDFLAGS =\
|
||||
-lw \
|
||||
-lintl \
|
||||
-lsocket \
|
||||
-lnsl \
|
||||
-lgen \
|
||||
-lm \
|
||||
-ldl
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
|
||||
OS_BEFORE_LDFLAGS =\
|
||||
-L/usr/dt/lib
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
|
||||
OS_BEFORE_LDFLAGS = -L/usr/X11R6/lib
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),HP-UX)
|
||||
|
||||
OS_BEFORE_LDFLAGS = -L$(DIST)/bin
|
||||
|
||||
endif
|
||||
|
||||
LDFLAGS =\
|
||||
$(OS_BEFORE_LDFLAGS) \
|
||||
$(DIST_FLAGS) \
|
||||
$(XFE_FLAGS) \
|
||||
$(X_LD_FLAGS) \
|
||||
$(OS_AFTER_LDFLAGS)
|
||||
|
||||
##
|
||||
## Test dependancies
|
||||
##
|
||||
#OTHER_DEPS = Makefile $(XFE_FLAGS)
|
||||
OTHER_DEPS = $(XFE_FLAGS)
|
||||
|
||||
##
|
||||
## Resource source rule
|
||||
##
|
||||
#$(OBJDIR)/%.ad.c:: %.ad # Makefile
|
||||
# @$(MAKE_OBJDIR)
|
||||
# @echo 'char * fallback_resources[] = {' > $@; \
|
||||
# ./ad2c $< >> $@; \
|
||||
# echo '0};' >> $@
|
||||
|
||||
##
|
||||
## Resource object rule
|
||||
##
|
||||
#$(OBJDIR)/%.ad.o: $(OBJDIR)/%.ad.c
|
||||
# @$(MAKE_OBJDIR)
|
||||
# $(CC) -o $@ -c $<
|
||||
|
||||
##
|
||||
## Binary link rule
|
||||
##
|
||||
$(OBJDIR)/%.exe: $(OBJDIR)/%.o $(OTHER_DEPS)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(XFE_PURIFY) $(CC) -o $@ $< $(LDFLAGS)
|
||||
2729
mozilla/cmd/xfe/Microline3.0/examples/demo.c
Normal file
2729
mozilla/cmd/xfe/Microline3.0/examples/demo.c
Normal file
File diff suppressed because it is too large
Load Diff
72
mozilla/cmd/xfe/Microline3.0/examples/folder1.c
Normal file
72
mozilla/cmd/xfe/Microline3.0/examples/folder1.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Label.h>
|
||||
#include <XmL/Folder.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, folder, form;
|
||||
XmString str;
|
||||
char buf[20];
|
||||
int i;
|
||||
|
||||
shell = XtAppInitialize(&app, "Folder1", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
folder = XtVaCreateManagedWidget("folder",
|
||||
xmlFolderWidgetClass, shell,
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
/* Add a tab and Form managed by the tab to the Folder */
|
||||
sprintf(buf, "Tab %d", i);
|
||||
str = XmStringCreateSimple(buf);
|
||||
form = XmLFolderAddTabForm(folder, str);
|
||||
XmStringFree(str);
|
||||
|
||||
/* Add a Label as a child of the Form */
|
||||
sprintf(buf, "Form %d", i);
|
||||
XtVaCreateManagedWidget(buf,
|
||||
xmLabelWidgetClass, form,
|
||||
XmNmarginWidth, 100,
|
||||
XmNmarginHeight, 80,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
}
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
108
mozilla/cmd/xfe/Microline3.0/examples/folder2.c
Normal file
108
mozilla/cmd/xfe/Microline3.0/examples/folder2.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/DrawnB.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/Label.h>
|
||||
#include <XmL/Folder.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, folder, tab, folderForm;
|
||||
XmString str;
|
||||
char pageName[20], tabName[20];
|
||||
int i;
|
||||
|
||||
shell = XtAppInitialize(&app, "Folder2", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNmarginWidth, 8,
|
||||
XmNmarginHeight, 8,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
folder = XtVaCreateManagedWidget("folder",
|
||||
xmlFolderWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNtabPlacement, XmFOLDER_RIGHT,
|
||||
XmNmarginWidth, 10,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
sprintf(pageName, "Page %d", i);
|
||||
|
||||
/* Add a tab (DrawnButton) to the Folder */
|
||||
sprintf(tabName, "Tab %d", i);
|
||||
str = XmStringCreateSimple(tabName);
|
||||
tab = XtVaCreateManagedWidget("tab",
|
||||
xmDrawnButtonWidgetClass, folder,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNlabelString, str,
|
||||
XmNtabManagedName, pageName,
|
||||
NULL);
|
||||
XmStringFree(str);
|
||||
|
||||
/* Add a Form to the Folder which will appear in the page */
|
||||
/* area. This Form will be managed by the tab created above */
|
||||
/* because it has the same tabManagedName as the tab widget */
|
||||
folderForm = XtVaCreateManagedWidget("folderForm",
|
||||
xmFormWidgetClass, folder,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNtabManagedName, pageName,
|
||||
NULL);
|
||||
|
||||
/* Add a Label as a child of the Form */
|
||||
XtVaCreateManagedWidget(pageName,
|
||||
xmLabelWidgetClass, folderForm,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNmarginWidth, 100,
|
||||
XmNmarginHeight, 80,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
}
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
125
mozilla/cmd/xfe/Microline3.0/examples/folder3.c
Normal file
125
mozilla/cmd/xfe/Microline3.0/examples/folder3.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/Label.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <XmL/Folder.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, folder, shellForm, label, button;
|
||||
XmString str;
|
||||
char buf[20];
|
||||
int i;
|
||||
static char tabName[6][20] =
|
||||
{
|
||||
"Standard",
|
||||
"PTEL Server",
|
||||
"NTEL Server",
|
||||
"Advanced",
|
||||
"Transfer Address",
|
||||
"Multimedia"
|
||||
};
|
||||
|
||||
shell = XtAppInitialize(&app, "Folder3", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNmarginWidth, 10,
|
||||
XmNmarginHeight, 10,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
folder = XtVaCreateManagedWidget("folder",
|
||||
xmlFolderWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNtabsPerRow, 3,
|
||||
XmNmarginWidth, 10,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
/* Add a tab and Form managed by the tab to the Folder */
|
||||
str = XmStringCreateSimple(tabName[i]);
|
||||
shellForm = XmLFolderAddTabForm(folder, str);
|
||||
XmStringFree(str);
|
||||
|
||||
XtVaSetValues(shellForm,
|
||||
XmNmarginWidth, 8,
|
||||
XmNmarginHeight, 8,
|
||||
NULL);
|
||||
|
||||
/* Add a Label as a child of the Form */
|
||||
sprintf(buf, "Label For Page %d", i);
|
||||
label = XtVaCreateManagedWidget(buf,
|
||||
xmLabelWidgetClass, shellForm,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNmarginWidth, 100,
|
||||
XmNmarginHeight, 80,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
/* Add a Button to pages 0 and 1 */
|
||||
if (i < 2)
|
||||
{
|
||||
button = XtVaCreateManagedWidget("Sample Button",
|
||||
xmPushButtonWidgetClass, shellForm,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNmarginWidth, 5,
|
||||
NULL);
|
||||
XtVaSetValues(label,
|
||||
XmNbottomAttachment, XmATTACH_WIDGET,
|
||||
XmNbottomWidget, button,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
XtVaSetValues(label,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
}
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
228
mozilla/cmd/xfe/Microline3.0/examples/folder4.c
Normal file
228
mozilla/cmd/xfe/Microline3.0/examples/folder4.c
Normal file
@@ -0,0 +1,228 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/DrawnB.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/Label.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <XmL/Folder.h>
|
||||
|
||||
void addTab();
|
||||
void removeTab();
|
||||
void activate();
|
||||
|
||||
#define sphere_width 16
|
||||
#define sphere_height 16
|
||||
static unsigned char sphere_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0x38, 0x3f,
|
||||
0xb8, 0x3f, 0xf8, 0x3f, 0xf8, 0x3f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f,
|
||||
0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
#define monitor_width 16
|
||||
#define monitor_height 16
|
||||
static unsigned char monitor_bits[] = {
|
||||
0x00, 0x00, 0xf8, 0x3f, 0xf8, 0x3f, 0x18, 0x30, 0x58, 0x37, 0x18, 0x30,
|
||||
0x58, 0x37, 0x18, 0x30, 0xf8, 0x3f, 0xf8, 0x3f, 0x80, 0x03, 0x80, 0x03,
|
||||
0xf0, 0x1f, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
Widget folder, label;
|
||||
|
||||
Pixmap monitorPixmap, spherePixmap;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, folderForm, addButton, removeButton;
|
||||
Pixel black, grey;
|
||||
|
||||
shell = XtAppInitialize(&app, "Folder4", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
XtVaSetValues(shell,
|
||||
XmNallowShellResize, True,
|
||||
NULL);
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNmarginWidth, 8,
|
||||
XmNmarginHeight, 8,
|
||||
XmNhorizontalSpacing, 4,
|
||||
XmNverticalSpacing, 4,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
/* Create Pixmaps with grey background (from form) */
|
||||
black = BlackPixelOfScreen(XtScreen(shell));
|
||||
XtVaGetValues(form,
|
||||
XmNbackground, &grey,
|
||||
NULL);
|
||||
spherePixmap = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
sphere_bits, sphere_width, sphere_height,
|
||||
black, grey,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
monitorPixmap = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
monitor_bits, monitor_width, monitor_height,
|
||||
black, grey,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
|
||||
removeButton = XtVaCreateManagedWidget("Remove Tab",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNmarginWidth, 10,
|
||||
NULL);
|
||||
XtAddCallback(removeButton, XmNactivateCallback, removeTab, NULL);
|
||||
|
||||
addButton = XtVaCreateManagedWidget("Add Tab",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNrightAttachment, XmATTACH_WIDGET,
|
||||
XmNrightWidget, removeButton,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNmarginWidth, 20,
|
||||
NULL);
|
||||
XtAddCallback(addButton, XmNactivateCallback, addTab, NULL);
|
||||
|
||||
folder = XtVaCreateManagedWidget("folder",
|
||||
xmlFolderWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNtabsPerRow, 4,
|
||||
XmNcornerStyle, XmCORNER_NONE,
|
||||
XmNspacing, 1,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_WIDGET,
|
||||
XmNbottomWidget, removeButton,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNresizePolicy, XmRESIZE_DYNAMIC,
|
||||
NULL);
|
||||
XtAddCallback(folder, XmNactivateCallback, activate, NULL);
|
||||
|
||||
/* Add a Form to the Folder, this will appear in the page area */
|
||||
folderForm = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, folder,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
NULL);
|
||||
|
||||
/* Add a Label as a child of the Form */
|
||||
label = XtVaCreateManagedWidget("Page Area",
|
||||
xmLabelWidgetClass, folderForm,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNmarginWidth, 100,
|
||||
XmNmarginHeight, 80,
|
||||
XmNrecomputeSize, False,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
void addTab(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
Widget tabButton, form;
|
||||
int count;
|
||||
char tabName[30];
|
||||
XmString str;
|
||||
Pixmap pixmap;
|
||||
|
||||
XtVaGetValues(folder,
|
||||
XmNtabCount, &count,
|
||||
NULL);
|
||||
|
||||
/* Every other tab will have a sphere pixmap */
|
||||
if (count % 2)
|
||||
pixmap = spherePixmap;
|
||||
else
|
||||
pixmap = monitorPixmap;
|
||||
|
||||
/* Add a tab (DrawnButton) to the Folder */
|
||||
sprintf(tabName, "Tab %d", count);
|
||||
str = XmStringCreateSimple(tabName);
|
||||
tabButton = XtVaCreateManagedWidget("tab",
|
||||
xmDrawnButtonWidgetClass, folder,
|
||||
XmNlabelString, str,
|
||||
XmNmarginWidth, 8,
|
||||
XmNtabPixmap, pixmap,
|
||||
XmNtabInactivePixmap, pixmap,
|
||||
NULL);
|
||||
XmStringFree(str);
|
||||
}
|
||||
|
||||
void removeTab(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
int count;
|
||||
WidgetList tabs;
|
||||
|
||||
XtVaGetValues(folder,
|
||||
XmNtabCount, &count,
|
||||
XmNtabWidgetList, &tabs,
|
||||
NULL);
|
||||
if (!count)
|
||||
return;
|
||||
XtDestroyWidget(tabs[count - 1]);
|
||||
}
|
||||
|
||||
void activate(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLFolderCallbackStruct *cbs;
|
||||
XmString str;
|
||||
char buf[20];
|
||||
int pos;
|
||||
|
||||
/* Change the Label in the page area to reflect */
|
||||
/* the selected position */
|
||||
cbs = (XmLFolderCallbackStruct *)callData;
|
||||
sprintf(buf, "Page %d", cbs->pos);
|
||||
str = XmStringCreateSimple(buf);
|
||||
XtVaSetValues(label,
|
||||
XmNlabelString, str,
|
||||
NULL);
|
||||
}
|
||||
67
mozilla/cmd/xfe/Microline3.0/examples/grid1.c
Normal file
67
mozilla/cmd/xfe/Microline3.0/examples/grid1.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Grid.h>
|
||||
|
||||
static char *data =
|
||||
"Europe|CD-ROM|$29\n\
|
||||
Yugoslovia|Floppy|$39\n\
|
||||
North America|Tape|$29\n\
|
||||
South America|CD-ROM|$49\n\
|
||||
Japan|Tape|$49\n\
|
||||
Russia|Floppy|$49\n\
|
||||
Poland|CD-ROM|$39\n\
|
||||
Norway|CD-ROM|$29\n\
|
||||
England|Tape|$49\n\
|
||||
Jordan|CD-ROM|$39";
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, grid;
|
||||
|
||||
shell = XtAppInitialize(&app, "Grid1", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
grid = XtVaCreateManagedWidget("grid",
|
||||
xmlGridWidgetClass, shell,
|
||||
XmNrows, 10,
|
||||
XmNvisibleRows, 7,
|
||||
XmNcolumns, 3,
|
||||
XmNsimpleWidths, "20c 8c 8c",
|
||||
XmNhorizontalSizePolicy, XmVARIABLE,
|
||||
NULL);
|
||||
XmLGridSetStrings(grid, data);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
160
mozilla/cmd/xfe/Microline3.0/examples/grid2.c
Normal file
160
mozilla/cmd/xfe/Microline3.0/examples/grid2.c
Normal file
@@ -0,0 +1,160 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <XmL/Grid.h>
|
||||
|
||||
void showSelected();
|
||||
|
||||
static char *data =
|
||||
"Country|Media|Price\n\
|
||||
Europe|CD-ROM|$29\n\
|
||||
Yugoslovia|Floppy|$39\n\
|
||||
North America|Tape|$29\n\
|
||||
South America|CD-ROM|$49\n\
|
||||
Japan|Tape|$49\n\
|
||||
Russia|Floppy|$49\n\
|
||||
Poland|CD-ROM|$39\n\
|
||||
Norway|CD-ROM|$29\n\
|
||||
England|Tape|$49\n\
|
||||
Jordan|CD-ROM|$39";
|
||||
|
||||
Widget grid;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, button;
|
||||
XmString str;
|
||||
|
||||
shell = XtAppInitialize(&app, "Grid2", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNmarginWidth, 5,
|
||||
XmNmarginHeight, 5,
|
||||
XmNverticalSpacing, 5,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
str = XmStringCreateSimple("Print Selected");
|
||||
button = XtVaCreateManagedWidget("button",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNlabelString, str,
|
||||
NULL);
|
||||
XmStringFree(str);
|
||||
XtAddCallback(button, XmNactivateCallback, showSelected, NULL);
|
||||
|
||||
/* Create a Grid in multiple row select mode with 1 heading row */
|
||||
/* and 3 columns */
|
||||
grid = XtVaCreateManagedWidget("grid",
|
||||
xmlGridWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XtVaTypedArg, XmNselectBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNselectForeground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
|
||||
XmNheadingRows, 1,
|
||||
XmNvisibleRows, 7,
|
||||
XmNcolumns, 3,
|
||||
XmNsimpleWidths, "20c 10c 10c",
|
||||
XmNhorizontalSizePolicy, XmVARIABLE,
|
||||
XmNvsbDisplayPolicy, XmSTATIC,
|
||||
XmNhighlightRowMode, True,
|
||||
XmNselectionPolicy, XmSELECT_MULTIPLE_ROW,
|
||||
XmNshadowThickness, 0,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_WIDGET,
|
||||
XmNbottomWidget, button,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
/* Set default cell values for new cells (which will be the */
|
||||
/* cells created when we add content rows) */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XmNcellRightBorderType, XmBORDER_NONE,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XmNcellBottomBorderType, XmBORDER_NONE,
|
||||
NULL);
|
||||
/* Set default cell alignment for new cells in columns 0 and 1 */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumnRangeStart, 0,
|
||||
XmNcolumnRangeEnd, 1,
|
||||
XmNcellAlignment, XmALIGNMENT_LEFT,
|
||||
NULL);
|
||||
/* Set default cell alignment for new cells in column 2 */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumn, 2,
|
||||
XmNcellAlignment, XmALIGNMENT_RIGHT,
|
||||
NULL);
|
||||
/* Add 10 content rows */
|
||||
XtVaSetValues(grid,
|
||||
XmNrows, 10,
|
||||
NULL);
|
||||
XmLGridSetStrings(grid, data);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
void showSelected(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
int i, count, *pos;
|
||||
|
||||
printf ("Selected Rows: ");
|
||||
count = XmLGridGetSelectedRowCount(grid);
|
||||
if (count)
|
||||
{
|
||||
pos = (int *)malloc(sizeof(int) * count);
|
||||
XmLGridGetSelectedRows(grid, pos, count);
|
||||
for (i = 0; i < count; i++)
|
||||
printf ("%d ", pos[i]);
|
||||
free((char *)pos);
|
||||
}
|
||||
else
|
||||
printf ("none");
|
||||
printf ("\n");
|
||||
}
|
||||
290
mozilla/cmd/xfe/Microline3.0/examples/grid3.c
Normal file
290
mozilla/cmd/xfe/Microline3.0/examples/grid3.c
Normal file
@@ -0,0 +1,290 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/Text.h>
|
||||
#include <Xm/Label.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <XmL/Grid.h>
|
||||
|
||||
Widget label, text, grid, gridText;
|
||||
|
||||
static int busy = 0;
|
||||
|
||||
void cellFocus();
|
||||
void textModify();
|
||||
void copy();
|
||||
void paste();
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, copyButton, pasteButton;
|
||||
XmString str;
|
||||
char buf[4];
|
||||
int i;
|
||||
|
||||
shell = XtAppInitialize(&app, "Grid3", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
str = XmStringCreateSimple("(A 1)");
|
||||
label = XtVaCreateManagedWidget("label",
|
||||
xmLabelWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNmarginHeight, 4,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNlabelString, str,
|
||||
NULL);
|
||||
XmStringFree(str);
|
||||
|
||||
pasteButton = XtVaCreateManagedWidget("Paste To Focus",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNmarginHeight, 0,
|
||||
NULL);
|
||||
XtAddCallback(pasteButton, XmNactivateCallback, paste, NULL);
|
||||
|
||||
copyButton = XtVaCreateManagedWidget("Copy Selected",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNrightAttachment, XmATTACH_WIDGET,
|
||||
XmNrightWidget, pasteButton,
|
||||
XmNmarginHeight, 0,
|
||||
NULL);
|
||||
XtAddCallback(copyButton, XmNactivateCallback, copy, NULL);
|
||||
|
||||
text = XtVaCreateManagedWidget("text",
|
||||
xmTextWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_WIDGET,
|
||||
XmNleftWidget, label,
|
||||
XmNrightAttachment, XmATTACH_WIDGET,
|
||||
XmNrightWidget, copyButton,
|
||||
XmNmarginHeight, 0,
|
||||
NULL);
|
||||
|
||||
/* Create a Grid with 1 heading column and 1 heading row */
|
||||
grid = XtVaCreateManagedWidget("grid",
|
||||
xmlGridWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNheadingColumns, 1,
|
||||
XmNcolumns, 26,
|
||||
XmNvisibleColumns, 8,
|
||||
XmNhsbDisplayPolicy, XmSTATIC,
|
||||
XmNrows, 100,
|
||||
XmNheadingRows, 1,
|
||||
XmNvisibleRows, 12,
|
||||
XmNvsbDisplayPolicy, XmSTATIC,
|
||||
XmNallowDragSelected, True,
|
||||
XmNallowDrop, True,
|
||||
XmNallowRowResize, True,
|
||||
XmNallowColumnResize, True,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNtopWidget, text,
|
||||
XmNtopOffset, 2,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNshadowThickness, 0,
|
||||
XmNselectionPolicy, XmSELECT_CELL,
|
||||
NULL);
|
||||
|
||||
/* Make all cells in the content rows and content columns */
|
||||
/* (the data cells) editable and set their borders and color */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellEditable, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XmNcellAlignment, XmALIGNMENT_RIGHT,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XtVaTypedArg, XmNcellRightBorderColor, XmRString, "#606060", 8,
|
||||
XtVaTypedArg, XmNcellBottomBorderColor, XmRString, "#606060", 8,
|
||||
NULL);
|
||||
|
||||
/* Add callbacks which update the Label and to synchronize */
|
||||
/* the Text widget outside the Grid with the one inside the Grid */
|
||||
XtAddCallback(grid, XmNcellFocusCallback, cellFocus, NULL);
|
||||
XtAddCallback(text, XmNvalueChangedCallback, textModify, NULL);
|
||||
XtVaGetValues(grid,
|
||||
XmNtextWidget, &gridText,
|
||||
NULL);
|
||||
XtAddCallback(gridText, XmNvalueChangedCallback, textModify, NULL);
|
||||
|
||||
XtVaSetValues(gridText,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "white", 6,
|
||||
NULL);
|
||||
|
||||
/* Set the labels on the heading rows and columns */
|
||||
for (i = 0; i < 26; i++)
|
||||
{
|
||||
sprintf(buf, "%c", 'A' + i);
|
||||
XmLGridSetStringsPos(grid, XmHEADING, 0, XmCONTENT, i, buf);
|
||||
}
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
sprintf(buf, "%d", i + 1);
|
||||
XmLGridSetStringsPos(grid, XmCONTENT, i, XmHEADING, 0, buf);
|
||||
}
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
|
||||
void cellFocus(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridRow row;
|
||||
XmLGridColumn column;
|
||||
Widget sharedText;
|
||||
XmString str;
|
||||
char buf[10], *c;
|
||||
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
if (cbs->reason != XmCR_CELL_FOCUS_IN)
|
||||
return;
|
||||
|
||||
/* Update the Label to reflect the new focus position */
|
||||
sprintf(buf, "(%c %d)", 'A' + cbs->column, cbs->row + 1);
|
||||
str = XmStringCreateSimple(buf);
|
||||
XtVaSetValues(label,
|
||||
XmNlabelString, str,
|
||||
NULL);
|
||||
XmStringFree(str);
|
||||
|
||||
/* Set the Text widget outside the Grid to the string contained */
|
||||
/* in the new focus cell. We set busy here because this change will */
|
||||
/* generate a valueChanged callback and we want to notify our */
|
||||
/* valueChanged callback not to do any processing because of */
|
||||
/* this change */
|
||||
if (busy)
|
||||
return;
|
||||
busy = 1;
|
||||
row = XmLGridGetRow(w, cbs->rowType, cbs->row);
|
||||
column = XmLGridGetColumn(w, cbs->columnType, cbs->column);
|
||||
XtVaGetValues(w,
|
||||
XmNrowPtr, row,
|
||||
XmNcolumnPtr, column,
|
||||
XmNcellString, &str,
|
||||
NULL);
|
||||
c = 0;
|
||||
if (str)
|
||||
XmStringGetLtoR(str, XmSTRING_DEFAULT_CHARSET, &c);
|
||||
if (c)
|
||||
{
|
||||
XmTextSetString(text, c);
|
||||
XtFree(c);
|
||||
XmTextSetSelection(text, 0, XmTextGetLastPosition(text),
|
||||
CurrentTime);
|
||||
}
|
||||
else
|
||||
XmTextSetString(text, "");
|
||||
if (str)
|
||||
XmStringFree(str);
|
||||
busy = 0;
|
||||
}
|
||||
|
||||
void textModify(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
int row, column;
|
||||
Boolean focusIn;
|
||||
XmString str;
|
||||
char *c;
|
||||
|
||||
/* If either Text widget changes (the Grid's Text widget or */
|
||||
/* the Text widget outside of the Grid), update the other one */
|
||||
/* to reflect to change and update the Grid itself if the */
|
||||
/* Text widget outside the Grid changes. We set busy in this */
|
||||
/* function to keep the XmTextSetString() from causing this */
|
||||
/* callback to be called while inside the callback. */
|
||||
if (busy)
|
||||
return;
|
||||
busy = 1;
|
||||
c = XmTextGetString(w);
|
||||
if (w == gridText)
|
||||
XmTextSetString(text, c);
|
||||
else
|
||||
{
|
||||
XmLGridGetFocus(grid, &row, &column, &focusIn);
|
||||
if (row != -1 && column != -1)
|
||||
{
|
||||
str = XmStringCreateSimple(c);
|
||||
XtVaSetValues(grid,
|
||||
XmNrow, row,
|
||||
XmNcolumn, column,
|
||||
XmNcellString, str,
|
||||
NULL);
|
||||
XmStringFree(str);
|
||||
XmTextSetString(gridText, c);
|
||||
}
|
||||
}
|
||||
XtFree(c);
|
||||
busy = 0;
|
||||
}
|
||||
|
||||
void copy(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLGridCopySelected(grid, CurrentTime);
|
||||
}
|
||||
|
||||
void paste(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
/* This pastes starting at the current focus cell, an alternative */
|
||||
/* method of pasting would be to have the user select an area */
|
||||
/* to paste into. To perform this, we could get the selected area */
|
||||
/* and use XmLGridPastePos() to paste into that area */
|
||||
XmLGridPaste(grid);
|
||||
}
|
||||
285
mozilla/cmd/xfe/Microline3.0/examples/grid4.c
Normal file
285
mozilla/cmd/xfe/Microline3.0/examples/grid4.c
Normal file
@@ -0,0 +1,285 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <XmL/Grid.h>
|
||||
|
||||
void cellSelect();
|
||||
void showSelected();
|
||||
|
||||
#define HEADINGFONT "-*-helvetica-bold-o-*--*-100-*-*-*-*-iso8859-1"
|
||||
#define CONTENTFONT "-*-helvetica-medium-r-*--*-100-*-*-*-*-iso8859-1"
|
||||
|
||||
#define check_width 9
|
||||
#define check_height 9
|
||||
static unsigned char check_bits[] = {
|
||||
0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x61, 0x00, 0x37, 0x00, 0x3e, 0x00,
|
||||
0x1c, 0x00, 0x08, 0x00, 0x00, 0x00};
|
||||
|
||||
#define nocheck_width 9
|
||||
#define nocheck_height 9
|
||||
static char nocheck_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static char *data[20] =
|
||||
{
|
||||
"3|Bob Thompson|bobt@teledyne.com",
|
||||
"12|Darl Simon|ds@atg.org",
|
||||
"14|Jacq Frontier|jf@terrax.com",
|
||||
"19|Patty Lee|patlee@isis.com",
|
||||
"22|Michal Barnes|mickeyb@softorb.com",
|
||||
"23|Dave Schultz|daves@timing.com",
|
||||
"23|Eric Stanley|ericst@aldor.com",
|
||||
"29|Tim Winters|timw@terra.com",
|
||||
"31|Agin Tomitu|agt@umn.edu",
|
||||
"33|Betty Tinner|bett@ost.edu",
|
||||
"37|Tom Smith|tsmith@netwld.com",
|
||||
"38|Rick Wild|raw@mlsoft.com",
|
||||
"41|Al Joyce|aj@ulm.edu",
|
||||
"41|Tim Burtan|timb@autoc.com",
|
||||
"41|George Marlin|gjm@eyeln.com",
|
||||
"41|Bill Boxer|billb@idesk.com",
|
||||
"41|Maria Montez|marm@ohio.edu",
|
||||
"41|Yin Fang|aj@utxs.edu",
|
||||
"41|Suzy Saps|ss@umg.edu",
|
||||
"41|Jerry Rodgers|jr@lyra.com",
|
||||
};
|
||||
|
||||
Pixmap nocheckPix, checkPix;
|
||||
Widget grid;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, button;
|
||||
Pixel blackPixel, whitePixel;
|
||||
Pixmap pix;
|
||||
int i;
|
||||
|
||||
shell = XtAppInitialize(&app, "Grid4", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
/* Create the pixmaps used for checkmarks */
|
||||
blackPixel = BlackPixelOfScreen(XtScreen(shell));
|
||||
whitePixel = WhitePixelOfScreen(XtScreen(shell));
|
||||
checkPix = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
check_bits, check_width, check_height,
|
||||
blackPixel, whitePixel,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
nocheckPix = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
nocheck_bits, nocheck_width, nocheck_height,
|
||||
blackPixel, whitePixel,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
button = XtVaCreateManagedWidget("Show Selected",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
XtAddCallback(button, XmNactivateCallback, showSelected, NULL);
|
||||
|
||||
/* Create a Grid with 4 columns. We set the fontList in this */
|
||||
/* function for the Grid to use when calculating the visible rows */
|
||||
grid = XtVaCreateManagedWidget("grid",
|
||||
xmlGridWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XtVaTypedArg, XmNfontList, XmRString, CONTENTFONT,
|
||||
strlen(CONTENTFONT) + 1,
|
||||
XmNcolumns, 4,
|
||||
XmNsimpleWidths, "3c 4c 17c 20c",
|
||||
XmNhorizontalSizePolicy, XmVARIABLE,
|
||||
XmNvsbDisplayPolicy, XmSTATIC,
|
||||
XmNvisibleRows, 13,
|
||||
XmNselectionPolicy, XmSELECT_NONE,
|
||||
XmNhighlightRowMode, True,
|
||||
XmNshadowType, XmSHADOW_ETCHED_IN,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_WIDGET,
|
||||
XmNbottomWidget, button,
|
||||
NULL);
|
||||
XtAddCallback(grid, XmNselectCallback, cellSelect, NULL);
|
||||
|
||||
/* Freeze the Grid's layout since we will be making changes which */
|
||||
/* would cause the Grid to recompute its layout. The Grid will */
|
||||
/* recompute its layout when layoutFrozen is set back to False */
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, True,
|
||||
NULL);
|
||||
|
||||
/* Set defaults for new cells and aligments for new cells in */
|
||||
/* columns 1-3. Then, add a heading row */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, HEADINGFONT,
|
||||
strlen(HEADINGFONT) + 1,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNcellForeground, XmRString, "white", 6,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XmNcellRightBorderType, XmBORDER_NONE,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XmNcellBottomBorderType, XmBORDER_NONE,
|
||||
NULL);
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumn, 1,
|
||||
XmNcellAlignment, XmALIGNMENT_RIGHT,
|
||||
NULL);
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumnRangeStart, 2,
|
||||
XmNcolumnRangeEnd, 3,
|
||||
XmNcellAlignment, XmALIGNMENT_LEFT,
|
||||
NULL);
|
||||
XmLGridAddRows(grid, XmHEADING, -1, 1);
|
||||
|
||||
/* Set the headings */
|
||||
XmLGridSetStrings(grid, "OD|Qty|Name|EMail Addr");
|
||||
|
||||
/* Set defaults for new cells. Also, set the default cell type */
|
||||
/* for cells in column 0 to pixmap cell. Then add the content rows */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, CONTENTFONT,
|
||||
strlen(CONTENTFONT) + 1,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNcellForeground, XmRString, "black", 6,
|
||||
XmNcellBottomBorderType, XmBORDER_LINE,
|
||||
XtVaTypedArg, XmNcellBottomBorderColor, XmRString, "black", 6,
|
||||
NULL);
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumn, 0,
|
||||
XmNcellType, XmPIXMAP_CELL,
|
||||
NULL);
|
||||
XmLGridAddRows(grid, XmCONTENT, -1, 20);
|
||||
|
||||
/* Set the content rows, Rows 2, 4, 5, 8 and 13 will have checkmarks */
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
XmLGridSetStringsPos(grid, XmCONTENT, i, XmCONTENT, 1, data[i]);
|
||||
if (i == 2 || i == 4 || i == 5 || i == 8 || i == 13)
|
||||
pix = checkPix;
|
||||
else
|
||||
pix = nocheckPix;
|
||||
XtVaSetValues(grid,
|
||||
XmNcolumn, 0,
|
||||
XmNrow, i,
|
||||
XmNcellPixmap, pix,
|
||||
NULL);
|
||||
}
|
||||
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, False,
|
||||
NULL);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
void showSelected(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLGridRow row;
|
||||
XmLGridColumn column;
|
||||
Pixmap pix;
|
||||
int i, n;
|
||||
|
||||
/* Display the selected rows, these are the rows which have a */
|
||||
/* checkPix Pixmap in the first cell in the row */
|
||||
printf ("Selected Rows: ");
|
||||
XtVaGetValues(grid,
|
||||
XmNrows, &n,
|
||||
NULL);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
row = XmLGridGetRow(grid, XmCONTENT, i);
|
||||
column = XmLGridGetColumn(grid, XmCONTENT, 0);
|
||||
XtVaGetValues(grid,
|
||||
XmNrowPtr, row,
|
||||
XmNcolumnPtr, column,
|
||||
XmNcellPixmap, &pix,
|
||||
NULL);
|
||||
if (pix == checkPix)
|
||||
printf ("%d ", i);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
void cellSelect(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridRow row;
|
||||
XmLGridColumn column;
|
||||
Pixmap pix;
|
||||
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
if (cbs->reason != XmCR_SELECT_CELL)
|
||||
return;
|
||||
if (cbs->rowType != XmCONTENT)
|
||||
return;
|
||||
|
||||
/* Toggle the Pixmap in the first cell */
|
||||
row = XmLGridGetRow(w, cbs->rowType, cbs->row);
|
||||
column = XmLGridGetColumn(w, XmCONTENT, 0);
|
||||
XtVaGetValues(w,
|
||||
XmNrowPtr, row,
|
||||
XmNcolumnPtr, column,
|
||||
XmNcellPixmap, &pix,
|
||||
NULL);
|
||||
if (pix == nocheckPix)
|
||||
pix = checkPix;
|
||||
else
|
||||
pix = nocheckPix;
|
||||
XtVaSetValues(w,
|
||||
XmNrow, cbs->row,
|
||||
XmNcolumn, 0,
|
||||
XmNcellPixmap, pix,
|
||||
NULL);
|
||||
}
|
||||
202
mozilla/cmd/xfe/Microline3.0/examples/grid5.c
Normal file
202
mozilla/cmd/xfe/Microline3.0/examples/grid5.c
Normal file
@@ -0,0 +1,202 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Grid.h>
|
||||
|
||||
#define TITLEFONT "-*-helvetica-bold-r-*--*-140-*-*-*-*-iso8859-1"
|
||||
#define BOLDFONT "-*-helvetica-bold-r-*--*-120-*-*-*-*-iso8859-1"
|
||||
#define TEXTFONT "-*-helvetica-medium-r-*--*-100-*-*-*-*-iso8859-1"
|
||||
|
||||
static char *data =
|
||||
"|1996 Income Summary\n\
|
||||
|Shampoo|Conditioner|Soap|Total\n\
|
||||
Revenues:\n\
|
||||
Sales|$ 1,600,000|$ 1,000,000|$ 800,000|$ 3,400,000\n\
|
||||
Less Discounts|(16,000)|(10,000)|(8,000)|(34,000)\n\
|
||||
Less Return Allowance|(8,000)|(5,000)|(4,000)|(17,000)\n\
|
||||
Net Revenue|1,576,000|985,000|792,000|3,349,000\n\
|
||||
\n\
|
||||
Less Expenses:\n\
|
||||
Cost of Goods Sold|(640,000)|(330,000)|(264,000)|(1,234,000)\n\
|
||||
Salary Expense|(380,000)|(280,000)|(180,000)|(840,000)\n\
|
||||
Marketing Expense|(157,600)|(98,500)|(79,200)|(335,300)\n\
|
||||
Rent Expense|(36,000)|(36,000)|(36,000)|(108,000)\n\
|
||||
Misc. Other Expense|(36,408)|(22,335)|(16,776)|(75,519)\n\
|
||||
Total Expenses|(1,250,008)|(766,835)|(575,976)|(2,592,819)\n\
|
||||
\n\
|
||||
Income Tax Expense|(130,397)|(87,266)|(86,410)|(304,072)\n\
|
||||
Net Income|195,595|130,899|129,614|456,109";
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, grid;
|
||||
int i, r;
|
||||
|
||||
shell = XtAppInitialize(&app, "Grid5", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
grid = XtVaCreateManagedWidget("grid",
|
||||
xmlGridWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XmNheadingColumns, 1,
|
||||
XmNcolumns, 3,
|
||||
XmNfooterColumns, 1,
|
||||
XmNsimpleWidths, "24c 11c 11c 11c 11c",
|
||||
XmNvisibleColumns, 10,
|
||||
XmNvisibleRows, 14,
|
||||
XtVaTypedArg, XmNfontList, XmRString, TEXTFONT,
|
||||
strlen(TEXTFONT) + 1,
|
||||
XmNselectionPolicy, XmSELECT_NONE,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, True,
|
||||
NULL);
|
||||
|
||||
/* Add 'Income Summary' heading row with yellow background */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "#FFFF00", 8,
|
||||
XtVaTypedArg, XmNcellForeground, XmRString, "#000080", 8,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XmNcellRightBorderType, XmBORDER_NONE,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XtVaTypedArg, XmNcellBottomBorderColor, XmRString, "black", 6,
|
||||
XmNcellAlignment, XmALIGNMENT_CENTER,
|
||||
NULL);
|
||||
XmLGridAddRows(grid, XmHEADING, -1, 1);
|
||||
|
||||
/* Set span on '1996 Income Summary' cell in heading row */
|
||||
XtVaSetValues(grid,
|
||||
XmNrowType, XmHEADING,
|
||||
XmNrow, 0,
|
||||
XmNcolumn, 0,
|
||||
XmNcellColumnSpan, 2,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, TITLEFONT,
|
||||
strlen(TITLEFONT) + 1,
|
||||
NULL);
|
||||
|
||||
/* Add 'Shampoo Conditioner Soap' heading row with white background */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, BOLDFONT,
|
||||
strlen(BOLDFONT) + 1,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNcellForeground, XmRString, "black", 6,
|
||||
XmNcellBottomBorderType, XmBORDER_NONE,
|
||||
NULL);
|
||||
XmLGridAddRows(grid, XmHEADING, -1, 1);
|
||||
|
||||
/* Add content and footer rows with heading column 0 left justified */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcellAlignment, XmALIGNMENT_RIGHT,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, TEXTFONT,
|
||||
strlen(TEXTFONT) + 1,
|
||||
NULL);
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumnType, XmHEADING,
|
||||
XmNcolumn, 0,
|
||||
XmNcellAlignment, XmALIGNMENT_LEFT,
|
||||
NULL);
|
||||
XmLGridAddRows(grid, XmCONTENT, -1, 15);
|
||||
|
||||
/* Add footer row with blue background */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellForeground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, BOLDFONT,
|
||||
strlen(BOLDFONT) + 1,
|
||||
NULL);
|
||||
XmLGridAddRows(grid, XmFOOTER, -1, 1);
|
||||
|
||||
/* Bold 'Revenues' cell */
|
||||
XtVaSetValues(grid,
|
||||
XmNcolumnType, XmHEADING,
|
||||
XmNcolumn, 0,
|
||||
XmNrow, 0,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, BOLDFONT,
|
||||
strlen(BOLDFONT) + 1,
|
||||
NULL);
|
||||
|
||||
/* Bold 'Less Expenses' cell */
|
||||
XtVaSetValues(grid,
|
||||
XmNcolumnType, XmHEADING,
|
||||
XmNcolumn, 0,
|
||||
XmNrow, 6,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, BOLDFONT,
|
||||
strlen(BOLDFONT) + 1,
|
||||
NULL);
|
||||
|
||||
/* Grey middle and footer content column */
|
||||
XtVaSetValues(grid,
|
||||
XmNcolumnType, XmALL_TYPES,
|
||||
XmNcolumnRangeStart, 2,
|
||||
XmNcolumnRangeEnd, 4,
|
||||
XmNcolumnStep, 2,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "#E8E8E8", 8,
|
||||
NULL);
|
||||
|
||||
/* Grey 'Conditioner' and 'Total' cell in heading row 1 */
|
||||
XtVaSetValues(grid,
|
||||
XmNrowType, XmHEADING,
|
||||
XmNrow, 1,
|
||||
XmNcolumnType, XmALL_TYPES,
|
||||
XmNcolumnRangeStart, 2,
|
||||
XmNcolumnRangeEnd, 4,
|
||||
XmNcolumnStep, 2,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "#E8E8E8", 8,
|
||||
NULL);
|
||||
|
||||
/* Blue and bold 'Net Revenue' and 'Total Expenses' rows */
|
||||
XtVaSetValues(grid,
|
||||
XmNrowRangeStart, 4,
|
||||
XmNrowRangeEnd, 12,
|
||||
XmNrowStep, 8,
|
||||
XmNcolumnType, XmALL_TYPES,
|
||||
XtVaTypedArg, XmNcellForeground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNcellFontList, XmRString, BOLDFONT,
|
||||
strlen(BOLDFONT) + 1,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, False,
|
||||
NULL);
|
||||
|
||||
XmLGridSetStrings(grid, data);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
465
mozilla/cmd/xfe/Microline3.0/examples/grid6.c
Normal file
465
mozilla/cmd/xfe/Microline3.0/examples/grid6.c
Normal file
@@ -0,0 +1,465 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Text.h>
|
||||
#include <XmL/Grid.h>
|
||||
|
||||
/* DATABASE PROTOTYPE FUNCTIONS */
|
||||
|
||||
int dbTableNumRows = 14;
|
||||
int dbTableNumColumns = 5;
|
||||
|
||||
typedef enum {
|
||||
ID, Desc, Price, Qty, UnitPrice, Buyer
|
||||
}
|
||||
DbTableColumnID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DbTableColumnID id;
|
||||
char label[15];
|
||||
int width;
|
||||
unsigned char cellAlignment;
|
||||
Boolean cellEditable;
|
||||
} DbTableColumn;
|
||||
|
||||
DbTableColumn dbTableColumns[] =
|
||||
{
|
||||
{ Desc, "Description", 16, XmALIGNMENT_LEFT, True },
|
||||
{ Price, "Price", 9, XmALIGNMENT_LEFT, True },
|
||||
{ Qty, "Qty", 5, XmALIGNMENT_LEFT, True },
|
||||
{ UnitPrice, "Unit Prc", 9, XmALIGNMENT_LEFT, False },
|
||||
{ Buyer, "Buyer", 15, XmALIGNMENT_LEFT, True },
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char key[10];
|
||||
char desc[20];
|
||||
float price;
|
||||
int qty;
|
||||
char buyer[20];
|
||||
} DbTableRow;
|
||||
|
||||
DbTableRow dbTableRows[] =
|
||||
{
|
||||
{ "key01", "Staples", 1.32, 100, "Tim Pick" },
|
||||
{ "key02", "Notebooks", 1.11, 4, "Mary Miner" },
|
||||
{ "key03", "3-Ring Binders", 2.59, 2, "Mary Miner" },
|
||||
{ "key04", "Pads", 1.23, 3, "Tim Pick" },
|
||||
{ "key05", "Scissors", 4.41, 1, "Mary Miner" },
|
||||
{ "key06", "Pens", .29, 4, "Mary Miner" },
|
||||
{ "key07", "Pencils", .10, 5, "Tim Pick" },
|
||||
{ "key08", "Markers", .95, 3, "Mary Miner" },
|
||||
{ "key09", "Fax Paper", 3.89, 100, "Bob Coal" },
|
||||
{ "key10", "3.5\" Disks", 15.23, 30, "Tim Pick" },
|
||||
{ "key11", "8mm Tape", 32.22, 2, "Bob Coal" },
|
||||
{ "key12", "Toner", 35.69, 1, "Tim Pick" },
|
||||
{ "key13", "Paper Cups", 4.25, 3, "Bob Coal" },
|
||||
{ "key14", "Paper Clips", 2.09, 3, "Tim Pick" },
|
||||
};
|
||||
|
||||
DbTableRow *dbFindRow(rowKey)
|
||||
char *rowKey;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dbTableNumRows; i++)
|
||||
if (!strcmp(rowKey, dbTableRows[i].key))
|
||||
return &dbTableRows[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dbCompareRowKeys(userData, l, r)
|
||||
void *userData;
|
||||
void *l;
|
||||
void *r;
|
||||
{
|
||||
DbTableRow *dbRow1, *dbRow2;
|
||||
float u1, u2;
|
||||
|
||||
dbRow1 = dbFindRow(*(char **)l);
|
||||
dbRow2 = dbFindRow(*(char **)r);
|
||||
switch ((int)userData)
|
||||
{
|
||||
case Desc:
|
||||
return strcmp(dbRow1->desc, dbRow2->desc);
|
||||
case Price:
|
||||
u1 = dbRow1->price - dbRow2->price;
|
||||
if (u1 < 0)
|
||||
return -1;
|
||||
else if (u1 == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
case Qty:
|
||||
return dbRow1->qty - dbRow2->qty;
|
||||
case UnitPrice:
|
||||
u1 = dbRow1->price / (float)dbRow1->qty;
|
||||
u2 = dbRow2->price / (float)dbRow2->qty;
|
||||
if (u1 < u2)
|
||||
return -1;
|
||||
else if (u1 == u2)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
case Buyer:
|
||||
return strcmp(dbRow1->buyer, dbRow2->buyer);
|
||||
}
|
||||
return (int)(dbRow1 - dbRow2);
|
||||
}
|
||||
|
||||
char **dbGetRowKeysSorted(sortColumnID)
|
||||
int sortColumnID;
|
||||
{
|
||||
char **keys;
|
||||
int i;
|
||||
|
||||
keys = (char **)malloc(sizeof(char *) * dbTableNumRows);
|
||||
for (i = 0; i < dbTableNumRows; i++)
|
||||
keys[i] = dbTableRows[i].key;
|
||||
XmLSort(keys, dbTableNumRows, sizeof(char *),
|
||||
dbCompareRowKeys, (void *)sortColumnID);
|
||||
return keys;
|
||||
}
|
||||
|
||||
/* GRID FUNCTIONS */
|
||||
|
||||
void setRowKeysInGridSorted(grid, sortColumnID)
|
||||
Widget grid;
|
||||
int sortColumnID;
|
||||
{
|
||||
char **keys;
|
||||
int i;
|
||||
|
||||
keys = dbGetRowKeysSorted(sortColumnID);
|
||||
/* Place a pointer to each row key in each rows userData */
|
||||
for (i = 0; i < dbTableNumRows; i++)
|
||||
XtVaSetValues(grid,
|
||||
XmNrow, i,
|
||||
XmNrowUserData, (XtPointer)keys[i],
|
||||
NULL);
|
||||
free((char *)keys);
|
||||
}
|
||||
|
||||
void cellSelect(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridColumn column;
|
||||
XtPointer columnUserData;
|
||||
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
|
||||
if (cbs->rowType != XmHEADING)
|
||||
return;
|
||||
|
||||
/* Cancel any edits in progress */
|
||||
XmLGridEditCancel(w);
|
||||
|
||||
column = XmLGridGetColumn(w, cbs->columnType, cbs->column);
|
||||
XtVaGetValues(w,
|
||||
XmNcolumnPtr, column,
|
||||
XmNcolumnUserData, &columnUserData,
|
||||
NULL);
|
||||
XtVaSetValues(w,
|
||||
XmNcolumn, cbs->column,
|
||||
XmNcolumnSortType, XmSORT_ASCENDING,
|
||||
NULL);
|
||||
setRowKeysInGridSorted(w, (DbTableColumnID)columnUserData);
|
||||
XmLGridRedrawAll(w);
|
||||
}
|
||||
|
||||
void cellDraw(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridDrawStruct *ds;
|
||||
XmLGridRow row;
|
||||
XmLGridColumn column;
|
||||
XtPointer rowUserData, columnUserData;
|
||||
DbTableRow *dbRow;
|
||||
XRectangle cellRect;
|
||||
int horizMargin, vertMargin;
|
||||
XmString str;
|
||||
char buf[50];
|
||||
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
if (cbs->rowType != XmCONTENT)
|
||||
return;
|
||||
|
||||
ds = cbs->drawInfo;
|
||||
|
||||
/* Retrieve userData from the cells row */
|
||||
row = XmLGridGetRow(w, cbs->rowType, cbs->row);
|
||||
XtVaGetValues(w,
|
||||
XmNrowPtr, row,
|
||||
XmNrowUserData, &rowUserData,
|
||||
NULL);
|
||||
|
||||
/* Retrieve userData from cells column */
|
||||
column = XmLGridGetColumn(w, cbs->columnType, cbs->column);
|
||||
XtVaGetValues(w,
|
||||
XmNcolumnPtr, column,
|
||||
XmNcolumnUserData, &columnUserData,
|
||||
NULL);
|
||||
|
||||
/* Retrieve the cells value from the database */
|
||||
dbRow = dbFindRow((char *)rowUserData);
|
||||
switch ((DbTableColumnID)columnUserData)
|
||||
{
|
||||
case Desc:
|
||||
sprintf(buf, "%s", dbRow->desc);
|
||||
break;
|
||||
case Price:
|
||||
sprintf(buf, "$%4.2f", dbRow->price);
|
||||
break;
|
||||
case Qty:
|
||||
sprintf(buf, "%d", dbRow->qty);
|
||||
break;
|
||||
case UnitPrice:
|
||||
sprintf(buf, "$%4.2f", dbRow->price / (float)dbRow->qty);
|
||||
break;
|
||||
case Buyer:
|
||||
sprintf(buf, "%s", dbRow->buyer);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Compensate for cell margins */
|
||||
cellRect = *ds->cellRect;
|
||||
horizMargin = ds->leftMargin + ds->rightMargin;
|
||||
vertMargin = ds->topMargin + ds->bottomMargin;
|
||||
if (horizMargin >= (int)cellRect.width ||
|
||||
vertMargin >= (int)cellRect.height)
|
||||
return;
|
||||
cellRect.x += ds->leftMargin;
|
||||
cellRect.y += ds->topMargin;
|
||||
cellRect.width -= horizMargin;
|
||||
cellRect.height -= vertMargin;
|
||||
|
||||
/* Draw the string */
|
||||
str = XmStringCreateSimple(buf);
|
||||
if (ds->drawSelected == True)
|
||||
XSetForeground(XtDisplay(w), ds->gc, ds->selectForeground);
|
||||
else
|
||||
XSetForeground(XtDisplay(w), ds->gc, ds->foreground);
|
||||
XmLStringDraw(w, str, ds->stringDirection, ds->fontList,
|
||||
ds->alignment, ds->gc, &cellRect, cbs->clipRect);
|
||||
XmStringFree(str);
|
||||
}
|
||||
|
||||
void cellEdit(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData;
|
||||
XtPointer callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridRow row;
|
||||
XmLGridColumn column;
|
||||
XtPointer rowUserData, columnUserData;
|
||||
DbTableRow *dbRow;
|
||||
Widget text;
|
||||
float f;
|
||||
int i;
|
||||
char *value;
|
||||
Boolean redrawRow;
|
||||
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
|
||||
/* For a production version, this function should also
|
||||
handle XmCR_EDIT_INSERT by retrieving the current value
|
||||
from the database and performing an XmTextSetString on
|
||||
the text widget in the grid with that value. This allows
|
||||
a user to hit insert or F2 to modify an existing cell value */
|
||||
|
||||
if (cbs->reason != XmCR_EDIT_COMPLETE)
|
||||
return;
|
||||
|
||||
/* Get the value the user just typed in */
|
||||
XtVaGetValues(w,
|
||||
XmNtextWidget, &text,
|
||||
NULL);
|
||||
value = XmTextGetString(text);
|
||||
if (!value)
|
||||
return;
|
||||
|
||||
/* Retrieve userData from the cells row */
|
||||
row = XmLGridGetRow(w, cbs->rowType, cbs->row);
|
||||
XtVaGetValues(w,
|
||||
XmNrowPtr, row,
|
||||
XmNrowUserData, &rowUserData,
|
||||
NULL);
|
||||
|
||||
/* Retrieve userData from cells column */
|
||||
column = XmLGridGetColumn(w, cbs->columnType, cbs->column);
|
||||
XtVaGetValues(w,
|
||||
XmNcolumnPtr, column,
|
||||
XmNcolumnUserData, &columnUserData,
|
||||
NULL);
|
||||
|
||||
/* Set new value in the database */
|
||||
redrawRow = False;
|
||||
dbRow = dbFindRow((char *)rowUserData);
|
||||
switch ((DbTableColumnID)columnUserData)
|
||||
{
|
||||
case Desc:
|
||||
if ((int)strlen(value) < 20)
|
||||
strcpy(dbRow->desc, value);
|
||||
break;
|
||||
case Price:
|
||||
if (sscanf(value, "%f", &f) == 1)
|
||||
{
|
||||
dbRow->price = f;
|
||||
redrawRow = True;
|
||||
}
|
||||
break;
|
||||
case Qty:
|
||||
if (sscanf(value, "%d", &i) == 1)
|
||||
{
|
||||
dbRow->qty = i;
|
||||
redrawRow = True;
|
||||
}
|
||||
break;
|
||||
case Buyer:
|
||||
if ((int)strlen(value) < 20)
|
||||
strcpy(dbRow->buyer, value);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Redraw the row if we need to redisplay unit price */
|
||||
if (redrawRow == True)
|
||||
XmLGridRedrawRow(w, cbs->rowType, cbs->row);
|
||||
|
||||
/* Set the cellString to NULL - its is set to the value the
|
||||
user typed in the text widget at this point */
|
||||
XtVaSetValues(w,
|
||||
XmNrow, cbs->row,
|
||||
XmNcolumn, cbs->column,
|
||||
XmNcellString, NULL,
|
||||
NULL);
|
||||
|
||||
XtFree(value);
|
||||
}
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, grid;
|
||||
XmString str;
|
||||
int i;
|
||||
|
||||
shell = XtAppInitialize(&app, "Grid6", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
grid = XtVaCreateManagedWidget("grid",
|
||||
xmlGridWidgetClass, shell,
|
||||
XmNhorizontalSizePolicy, XmVARIABLE,
|
||||
XmNvisibleRows, 10,
|
||||
XmNvsbDisplayPolicy, XmSTATIC,
|
||||
XmNselectionPolicy, XmSELECT_NONE,
|
||||
XmNshadowThickness, 0,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
NULL);
|
||||
XtAddCallback(grid, XmNcellDrawCallback, cellDraw, NULL);
|
||||
XtAddCallback(grid, XmNeditCallback, cellEdit, NULL);
|
||||
XtAddCallback(grid, XmNselectCallback, cellSelect, NULL);
|
||||
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, True,
|
||||
NULL);
|
||||
|
||||
XmLGridAddColumns(grid, XmCONTENT, -1, dbTableNumColumns);
|
||||
|
||||
/* Setup columns and column cell defaults based on */
|
||||
/* database description */
|
||||
for (i = 0; i < dbTableNumColumns; i++)
|
||||
{
|
||||
/* Set the width and the id on the column */
|
||||
XtVaSetValues(grid,
|
||||
XmNcolumn, i,
|
||||
XmNcolumnUserData, (XtPointer)dbTableColumns[i].id,
|
||||
XmNcolumnWidth, dbTableColumns[i].width,
|
||||
NULL);
|
||||
|
||||
/* Set the default cell alignment and editibility for */
|
||||
/* cells in the column */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumn, i,
|
||||
XmNcellAlignment, dbTableColumns[i].cellAlignment,
|
||||
XmNcellEditable, dbTableColumns[i].cellEditable,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Add the heading row */
|
||||
XmLGridAddRows(grid, XmHEADING, -1, 1);
|
||||
|
||||
/* Set the column headings */
|
||||
for (i = 0; i < dbTableNumColumns; i++)
|
||||
{
|
||||
/* Set the column heading label */
|
||||
str = XmStringCreateSimple(dbTableColumns[i].label);
|
||||
XtVaSetValues(grid,
|
||||
XmNrowType, XmHEADING,
|
||||
XmNrow, 0,
|
||||
XmNcolumn, i,
|
||||
XmNcellString, str,
|
||||
NULL);
|
||||
XmStringFree(str);
|
||||
}
|
||||
|
||||
/* Set cell defaults for content rows */
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XmNcellRightBorderType, XmBORDER_NONE,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XmNcellBottomBorderType, XmBORDER_NONE,
|
||||
XmNcellMarginLeft, 1,
|
||||
XmNcellMarginRight, 1,
|
||||
NULL);
|
||||
|
||||
XmLGridAddRows(grid, XmCONTENT, -1, dbTableNumRows);
|
||||
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, False,
|
||||
NULL);
|
||||
|
||||
/* Set the row keys in the rows */
|
||||
setRowKeysInGridSorted(grid, Desc);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
55
mozilla/cmd/xfe/Microline3.0/examples/prog1.c
Normal file
55
mozilla/cmd/xfe/Microline3.0/examples/prog1.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Progress.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, progress;
|
||||
|
||||
shell = XtAppInitialize(&app, "Prog1", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
progress = XtVaCreateManagedWidget("progress",
|
||||
xmlProgressWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "#000080", 8,
|
||||
XmNwidth, 300,
|
||||
XmNheight, 25,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(progress,
|
||||
XmNvalue, 50,
|
||||
NULL);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
81
mozilla/cmd/xfe/Microline3.0/examples/prog2.c
Normal file
81
mozilla/cmd/xfe/Microline3.0/examples/prog2.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Progress.h>
|
||||
|
||||
Boolean compute();
|
||||
|
||||
Widget progress;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell;
|
||||
|
||||
shell = XtAppInitialize(&app, "Prog2", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
progress = XtVaCreateManagedWidget("progress",
|
||||
xmlProgressWidgetClass, shell,
|
||||
XmNshowTime, True,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "#800000", 8,
|
||||
XmNwidth, 300,
|
||||
XmNheight, 25,
|
||||
NULL);
|
||||
|
||||
XtAppAddWorkProc(app, compute, NULL);
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
Boolean compute(clientData)
|
||||
XtPointer clientData;
|
||||
{
|
||||
int i;
|
||||
|
||||
XtVaSetValues(progress,
|
||||
XmNvalue, 0,
|
||||
XmNcompleteValue, 7,
|
||||
NULL);
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
XtVaSetValues(progress,
|
||||
XmNvalue, i,
|
||||
NULL);
|
||||
|
||||
/* perform processing */
|
||||
sleep(1);
|
||||
}
|
||||
XtVaSetValues(progress,
|
||||
XmNvalue, i,
|
||||
NULL);
|
||||
return(FALSE);
|
||||
}
|
||||
84
mozilla/cmd/xfe/Microline3.0/examples/prog3.c
Normal file
84
mozilla/cmd/xfe/Microline3.0/examples/prog3.c
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Progress.h>
|
||||
|
||||
Boolean compute();
|
||||
|
||||
Widget progress;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell;
|
||||
|
||||
shell = XtAppInitialize(&app, "Prog3", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
progress = XtVaCreateManagedWidget("progress",
|
||||
xmlProgressWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNtopShadowColor, XmRString, "#D0D0D0", 8,
|
||||
XtVaTypedArg, XmNbottomShadowColor, XmRString, "black", 6,
|
||||
XmNmeterStyle, XmMETER_BOXES,
|
||||
XmNnumBoxes, 20,
|
||||
XmNwidth, 300,
|
||||
XmNheight, 20,
|
||||
XmNshadowThickness, 1,
|
||||
NULL);
|
||||
|
||||
XtAppAddWorkProc(app, compute, NULL);
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
Boolean compute(clientData)
|
||||
XtPointer clientData;
|
||||
{
|
||||
int i;
|
||||
|
||||
XtVaSetValues(progress,
|
||||
XmNvalue, 0,
|
||||
XmNcompleteValue, 7,
|
||||
NULL);
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
XtVaSetValues(progress,
|
||||
XmNvalue, i,
|
||||
NULL);
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
XtVaSetValues(progress,
|
||||
XmNvalue, i,
|
||||
NULL);
|
||||
return(FALSE);
|
||||
}
|
||||
87
mozilla/cmd/xfe/Microline3.0/examples/tree1.c
Normal file
87
mozilla/cmd/xfe/Microline3.0/examples/tree1.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Tree.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, tree;
|
||||
Pixmap pixmap, pixmask;
|
||||
XmString str;
|
||||
|
||||
shell = XtAppInitialize(&app, "Tree1", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
tree = XtVaCreateManagedWidget("tree",
|
||||
xmlTreeWidgetClass, shell,
|
||||
XmNvisibleRows, 10,
|
||||
XmNwidth, 250,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(tree,
|
||||
XmNlayoutFrozen, True,
|
||||
NULL);
|
||||
|
||||
pixmap = XmUNSPECIFIED_PIXMAP;
|
||||
pixmask = XmUNSPECIFIED_PIXMAP;
|
||||
|
||||
str = XmStringCreateSimple("Root");
|
||||
XmLTreeAddRow(tree, 0, True, True, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("Level 1 Parent");
|
||||
XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("1st Child of Level 1 Parent");
|
||||
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("2nd Child of Level 1 Parent");
|
||||
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("Level 2 Parent");
|
||||
XmLTreeAddRow(tree, 2, True, True, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("Child of Level 2 Parent");
|
||||
XmLTreeAddRow(tree, 3, False, False, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("Level 1 Parent");
|
||||
XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("Child of Level 1 Parent");
|
||||
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
|
||||
XmStringFree(str);
|
||||
|
||||
XtVaSetValues(tree,
|
||||
XmNlayoutFrozen, False,
|
||||
NULL);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
99
mozilla/cmd/xfe/Microline3.0/examples/tree2.c
Normal file
99
mozilla/cmd/xfe/Microline3.0/examples/tree2.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Tree.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, tree;
|
||||
int i, n, size;
|
||||
XmString str;
|
||||
XmLTreeRowDefinition *rows;
|
||||
static struct
|
||||
{
|
||||
Boolean expands;
|
||||
int level;
|
||||
char *string;
|
||||
} data[] =
|
||||
{
|
||||
{ True, 0, "Root" },
|
||||
{ True, 1, "Level 1 Parent" },
|
||||
{ False, 2, "1st Child of Level 1 Parent" },
|
||||
{ False, 2, "2nd Child of Level 1 Parent" },
|
||||
{ True, 2, "Level 2 Parent" },
|
||||
{ False, 3, "Child of Level 2 Parent" },
|
||||
{ True, 1, "Level 1 Parent" },
|
||||
{ False, 2, "Child of Level 1 Parent" },
|
||||
};
|
||||
|
||||
shell = XtAppInitialize(&app, "Tree2", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
tree = XtVaCreateManagedWidget("tree",
|
||||
xmlTreeWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 6,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNselectBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNselectForeground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNconnectingLineColor, XmRString, "#808080", 8,
|
||||
XmNvisibleRows, 10,
|
||||
XmNwidth, 250,
|
||||
NULL);
|
||||
XtVaSetValues(tree,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
NULL);
|
||||
|
||||
/* Create a TreeRowDefinition array from the data array */
|
||||
/* and add rows to the Tree */
|
||||
n = 8;
|
||||
size = sizeof(XmLTreeRowDefinition) * n;
|
||||
rows = (XmLTreeRowDefinition *)malloc(size);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
rows[i].level = data[i].level;
|
||||
rows[i].expands = data[i].expands;
|
||||
rows[i].isExpanded = True;
|
||||
rows[i].pixmap = XmUNSPECIFIED_PIXMAP;
|
||||
rows[i].pixmask = XmUNSPECIFIED_PIXMAP;
|
||||
rows[i].string = XmStringCreateSimple(data[i].string);
|
||||
}
|
||||
XmLTreeAddRows(tree, rows, n, -1);
|
||||
|
||||
/* Free the TreeRowDefintion array (and XmStrings) we created above */
|
||||
for (i = 0; i < n; i++)
|
||||
XmStringFree(rows[i].string);
|
||||
free((char *)rows);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
155
mozilla/cmd/xfe/Microline3.0/examples/tree3.c
Normal file
155
mozilla/cmd/xfe/Microline3.0/examples/tree3.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <XmL/Tree.h>
|
||||
|
||||
#define sphere_width 16
|
||||
#define sphere_height 16
|
||||
static unsigned char sphere_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0x38, 0x3f,
|
||||
0xb8, 0x3f, 0xf8, 0x3f, 0xf8, 0x3f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f,
|
||||
0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
#define monitor_width 16
|
||||
#define monitor_height 16
|
||||
static unsigned char monitor_bits[] = {
|
||||
0x00, 0x00, 0xf8, 0x3f, 0xf8, 0x3f, 0x18, 0x30, 0x58, 0x37, 0x18, 0x30,
|
||||
0x58, 0x37, 0x18, 0x30, 0xf8, 0x3f, 0xf8, 0x3f, 0x80, 0x03, 0x80, 0x03,
|
||||
0xf0, 0x1f, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, tree;
|
||||
XmLTreeRowDefinition *rows;
|
||||
Pixmap monitorPixmap, spherePixmap;
|
||||
Pixel black, white;
|
||||
int i, n, size;
|
||||
static struct
|
||||
{
|
||||
Boolean expands;
|
||||
int level;
|
||||
char *string;
|
||||
} data[] =
|
||||
{
|
||||
{ True, 0, "Root" },
|
||||
{ True, 1, "Parent A" },
|
||||
{ False, 2, "Node A1" },
|
||||
{ False, 2, "Node A2" },
|
||||
{ True, 2, "Parent B" },
|
||||
{ False, 3, "Node B1" },
|
||||
{ False, 3, "Node B2" },
|
||||
{ True, 1, "Parent C" },
|
||||
{ False, 2, "Node C1" },
|
||||
{ True, 1, "Parent D" },
|
||||
{ False, 2, "Node D1" },
|
||||
};
|
||||
|
||||
shell = XtAppInitialize(&app, "Tree3", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
black = BlackPixelOfScreen(XtScreen(shell));
|
||||
white = WhitePixelOfScreen(XtScreen(shell));
|
||||
spherePixmap = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
sphere_bits, sphere_width, sphere_height,
|
||||
black, white,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
monitorPixmap = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
monitor_bits, monitor_width, monitor_height,
|
||||
black, white,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
|
||||
/* Create a Tree with 3 columns and 1 heading row in multiple */
|
||||
/* select mode. We also set globalPixmapWidth and height here */
|
||||
/* which specifys that every Pixmap we set on the Tree will be */
|
||||
/* the size specified (16x16). This will increase performance. */
|
||||
tree = XtVaCreateManagedWidget("tree",
|
||||
xmlTreeWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNselectBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNselectForeground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNconnectingLineColor, XmRString, "#808080", 8,
|
||||
XmNallowColumnResize, True,
|
||||
XmNheadingRows, 1,
|
||||
XmNvisibleRows, 14,
|
||||
XmNcolumns, 3,
|
||||
XmNvisibleColumns, 5,
|
||||
XmNsimpleWidths, "12c 8c 10c",
|
||||
XmNsimpleHeadings, "All Folders|SIZE|DATA2",
|
||||
XmNselectionPolicy, XmSELECT_MULTIPLE_ROW,
|
||||
XmNhighlightRowMode, True,
|
||||
XmNglobalPixmapWidth, 16,
|
||||
XmNglobalPixmapHeight, 16,
|
||||
NULL);
|
||||
|
||||
/* Set default values for new cells (the cells in the content rows) */
|
||||
XtVaSetValues(tree,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XmNcellRightBorderType, XmBORDER_NONE,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XmNcellBottomBorderType, XmBORDER_NONE,
|
||||
NULL);
|
||||
|
||||
/* Create a TreeRowDefinition array from the data array */
|
||||
/* and add rows to the Tree */
|
||||
n = 11;
|
||||
size = sizeof(XmLTreeRowDefinition) * n;
|
||||
rows = (XmLTreeRowDefinition *)malloc(size);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
rows[i].level = data[i].level;
|
||||
rows[i].expands = data[i].expands;
|
||||
rows[i].isExpanded = True;
|
||||
if (data[i].expands)
|
||||
rows[i].pixmap = spherePixmap;
|
||||
else
|
||||
rows[i].pixmap = monitorPixmap;
|
||||
rows[i].pixmask = XmUNSPECIFIED_PIXMAP;
|
||||
rows[i].string = XmStringCreateSimple(data[i].string);
|
||||
}
|
||||
XmLTreeAddRows(tree, rows, n, -1);
|
||||
|
||||
/* Free the TreeRowDefintion array we created above and set strings */
|
||||
/* in column 1 and 2 */
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
XmStringFree(rows[i].string);
|
||||
XmLGridSetStringsPos(tree, XmCONTENT, i, XmCONTENT, 1, "1032|1123");
|
||||
}
|
||||
free((char *)rows);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
295
mozilla/cmd/xfe/Microline3.0/examples/tree4.c
Normal file
295
mozilla/cmd/xfe/Microline3.0/examples/tree4.c
Normal file
@@ -0,0 +1,295 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <XmL/Grid.h>
|
||||
#include <XmL/Tree.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
void rowExpand();
|
||||
void rowCollapse();
|
||||
void rowDelete();
|
||||
void cellSelect();
|
||||
|
||||
Widget grid;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, tree;
|
||||
XmString str;
|
||||
|
||||
shell = XtAppInitialize(&app, "Tree4", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
/* Add Tree to left of Form */
|
||||
tree = XtVaCreateManagedWidget("tree",
|
||||
xmlTreeWidgetClass, form,
|
||||
XmNhorizontalSizePolicy, XmCONSTANT,
|
||||
XmNautoSelect, False,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNselectBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNselectForeground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNconnectingLineColor, XmRString, "#808080", 8,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_POSITION,
|
||||
XmNrightPosition, 45,
|
||||
NULL);
|
||||
XtVaSetValues(tree,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
NULL);
|
||||
|
||||
/* Add a single row containing the root path to the Tree */
|
||||
str = XmStringCreateSimple("/");
|
||||
XmLTreeAddRow(tree, 1, True, False, 0,
|
||||
XmUNSPECIFIED_PIXMAP, XmUNSPECIFIED_PIXMAP, str);
|
||||
XmStringFree(str);
|
||||
XtVaSetValues(tree,
|
||||
XmNrow, 0,
|
||||
XmNrowUserData, strdup("/"),
|
||||
NULL);
|
||||
|
||||
XtAddCallback(tree, XmNexpandCallback, rowExpand, NULL);
|
||||
XtAddCallback(tree, XmNcollapseCallback, rowCollapse, NULL);
|
||||
XtAddCallback(tree, XmNdeleteCallback, rowDelete, NULL);
|
||||
XtAddCallback(tree, XmNselectCallback, cellSelect, NULL);
|
||||
|
||||
/* Add a Grid to the right of the Form and set cell defaults */
|
||||
grid = XtVaCreateManagedWidget("grid",
|
||||
xmlGridWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNselectBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNselectForeground, XmRString, "white", 6,
|
||||
XmNcolumns, 3,
|
||||
XmNsimpleWidths, "24c 12c 10c",
|
||||
XmNsimpleHeadings, "Name|Type|Size",
|
||||
XmNvisibleColumns, 6,
|
||||
XmNallowColumnResize, True,
|
||||
XmNheadingRows, 1,
|
||||
XmNvisibleRows, 16,
|
||||
XmNhighlightRowMode, True,
|
||||
XmNleftAttachment, XmATTACH_POSITION,
|
||||
XmNleftPosition, 46,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XmNcellBottomBorderType, XmBORDER_NONE,
|
||||
XmNcellRightBorderType, XmBORDER_NONE,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XmNcellAlignment, XmALIGNMENT_LEFT,
|
||||
NULL);
|
||||
XtVaSetValues(grid,
|
||||
XmNcellDefaults, True,
|
||||
XmNcolumn, 2,
|
||||
XmNcellAlignment, XmALIGNMENT_RIGHT,
|
||||
NULL);
|
||||
|
||||
/* Invoke the select callback for the first row in the Tree */
|
||||
/* to fill the Grid with the data for the root path */
|
||||
XmLGridSelectRow(tree, 0, True);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
void rowExpand(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData, callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridRow row;
|
||||
int level, pos;
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
struct stat s;
|
||||
char *path, fullpath[1024];
|
||||
XmString str;
|
||||
|
||||
/* Retrieve the path of the directory expanded. This is kept */
|
||||
/* in the row's rowUserData */
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
row = XmLGridGetRow(w, XmCONTENT, cbs->row);
|
||||
XtVaGetValues(w,
|
||||
XmNrowPtr, row,
|
||||
XmNrowUserData, &path,
|
||||
XmNrowLevel, &level,
|
||||
NULL);
|
||||
pos = cbs->row + 1;
|
||||
dir = opendir(path);
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
/* Add the subdirectories of the directory expanded to the Tree */
|
||||
XtVaSetValues(w,
|
||||
XmNlayoutFrozen, True,
|
||||
NULL);
|
||||
while (d = readdir(dir))
|
||||
{
|
||||
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
||||
continue;
|
||||
sprintf(fullpath, "%s/%s", path, d->d_name);
|
||||
if (lstat(fullpath, &s) == -1)
|
||||
continue;
|
||||
if (!S_ISDIR(s.st_mode))
|
||||
continue;
|
||||
str = XmStringCreateSimple(d->d_name);
|
||||
XmLTreeAddRow(w, level + 1, True, False, pos,
|
||||
XmUNSPECIFIED_PIXMAP, XmUNSPECIFIED_PIXMAP, str);
|
||||
XmStringFree(str);
|
||||
XtVaSetValues(w,
|
||||
XmNrow, pos,
|
||||
XmNrowUserData, strdup(fullpath),
|
||||
NULL);
|
||||
pos++;
|
||||
}
|
||||
closedir(dir);
|
||||
XtVaSetValues(w,
|
||||
XmNlayoutFrozen, False,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void rowCollapse(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData, callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridRow row;
|
||||
char *path;
|
||||
int i, j, level, rows;
|
||||
|
||||
/* Collapse the row by deleting the rows in the tree which */
|
||||
/* are children of the collapsed row. */
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
|
||||
XmLTreeDeleteChildren(w, cbs->row);
|
||||
}
|
||||
|
||||
void rowDelete(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData, callData;
|
||||
{
|
||||
/* Free the path contained in the rowUserData of the rows deleted */
|
||||
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridRow row;
|
||||
char *path;
|
||||
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
|
||||
if (cbs->rowType != XmCONTENT || cbs->reason != XmCR_DELETE_ROW)
|
||||
return;
|
||||
|
||||
row = XmLGridGetRow(w, XmCONTENT, cbs->row);
|
||||
|
||||
XtVaGetValues(w,
|
||||
XmNrowPtr, row,
|
||||
XmNrowUserData, &path,
|
||||
NULL);
|
||||
|
||||
if (path)
|
||||
free(path);
|
||||
}
|
||||
|
||||
void cellSelect(w, clientData, callData)
|
||||
Widget w;
|
||||
XtPointer clientData, callData;
|
||||
{
|
||||
XmLGridCallbackStruct *cbs;
|
||||
XmLGridRow row;
|
||||
DIR *dir;
|
||||
struct stat s;
|
||||
struct dirent *d;
|
||||
char *path, fullpath[1024], buf[256];
|
||||
int pos;
|
||||
|
||||
/* Retrieve the directory selected */
|
||||
cbs = (XmLGridCallbackStruct *)callData;
|
||||
if (cbs->rowType != XmCONTENT)
|
||||
return;
|
||||
row = XmLGridGetRow(w, XmCONTENT, cbs->row);
|
||||
XtVaGetValues(w,
|
||||
XmNrowPtr, row,
|
||||
XmNrowUserData, &path,
|
||||
NULL);
|
||||
dir = opendir(path);
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
/* Add a row for each file in the directory to the Grid */
|
||||
pos = 0;
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, True,
|
||||
NULL);
|
||||
XmLGridDeleteAllRows(grid, XmCONTENT);
|
||||
while (d = readdir(dir))
|
||||
{
|
||||
sprintf(fullpath, "%s/%s", path, d->d_name);
|
||||
if (lstat(fullpath, &s) == -1)
|
||||
continue;
|
||||
XmLGridAddRows(grid, XmCONTENT, pos, 1);
|
||||
XmLGridSetStringsPos(grid, XmCONTENT, pos, XmCONTENT, 0, d->d_name);
|
||||
if (S_ISDIR(s.st_mode))
|
||||
sprintf(buf, "Directory");
|
||||
else if (S_ISLNK(s.st_mode))
|
||||
sprintf(buf, "Link");
|
||||
else
|
||||
sprintf(buf, "File");
|
||||
XmLGridSetStringsPos(grid, XmCONTENT, pos, XmCONTENT, 1, buf);
|
||||
sprintf(buf, "%d", (int)s.st_size);
|
||||
XmLGridSetStringsPos(grid, XmCONTENT, pos, XmCONTENT, 2, buf);
|
||||
pos++;
|
||||
}
|
||||
closedir(dir);
|
||||
XtVaSetValues(grid,
|
||||
XmNlayoutFrozen, False,
|
||||
NULL);
|
||||
}
|
||||
|
||||
218
mozilla/cmd/xfe/Microline3.0/examples/tree5.c
Normal file
218
mozilla/cmd/xfe/Microline3.0/examples/tree5.c
Normal file
@@ -0,0 +1,218 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <XmL/Tree.h>
|
||||
|
||||
#define sphere_width 16
|
||||
#define sphere_height 16
|
||||
static unsigned char sphere_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0x38, 0x3f,
|
||||
0xb8, 0x3f, 0xf8, 0x3f, 0xf8, 0x3f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f,
|
||||
0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
#define monitor_width 16
|
||||
#define monitor_height 16
|
||||
static unsigned char monitor_bits[] = {
|
||||
0x00, 0x00, 0xf8, 0x3f, 0xf8, 0x3f, 0x18, 0x30, 0x58, 0x37, 0x18, 0x30,
|
||||
0x58, 0x37, 0x18, 0x30, 0xf8, 0x3f, 0xf8, 0x3f, 0x80, 0x03, 0x80, 0x03,
|
||||
0xf0, 0x1f, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
#if 0
|
||||
void
|
||||
hide_cb(Widget w, XtPointer clientData, XtPointer cb_data)
|
||||
{
|
||||
Widget tree = (Widget) clientData;
|
||||
|
||||
XmLGridHideRightColumn(tree);
|
||||
}
|
||||
void
|
||||
show_cb(Widget w, XtPointer clientData, XtPointer cb_data)
|
||||
{
|
||||
Widget tree = (Widget) clientData;
|
||||
|
||||
XmLGridUnhideRightColumn(tree);
|
||||
}
|
||||
#endif /*0*/
|
||||
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, tree, form, hideB, showB;
|
||||
XmLTreeRowDefinition *rows;
|
||||
Pixmap monitorPixmap, spherePixmap;
|
||||
Pixel black, white;
|
||||
int i, n, size;
|
||||
static struct
|
||||
{
|
||||
Boolean expands;
|
||||
int level;
|
||||
char *string;
|
||||
} data[] =
|
||||
{
|
||||
{ True, 0, "Root" },
|
||||
{ True, 1, "Parent A" },
|
||||
{ False, 2, "Node A1" },
|
||||
{ False, 2, "Node A2" },
|
||||
{ True, 2, "Parent B" },
|
||||
{ False, 3, "Node B1" },
|
||||
{ False, 3, "Node B2" },
|
||||
{ True, 1, "Parent C" },
|
||||
{ False, 2, "Node C1" },
|
||||
{ True, 1, "Parent D" },
|
||||
{ False, 2, "Node D1" },
|
||||
};
|
||||
|
||||
shell = XtAppInitialize(&app, "Tree3", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
black = BlackPixelOfScreen(XtScreen(shell));
|
||||
white = WhitePixelOfScreen(XtScreen(shell));
|
||||
spherePixmap = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
sphere_bits, sphere_width, sphere_height,
|
||||
black, white,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
monitorPixmap = XCreatePixmapFromBitmapData(XtDisplay(shell),
|
||||
DefaultRootWindow(XtDisplay(shell)),
|
||||
monitor_bits, monitor_width, monitor_height,
|
||||
black, white,
|
||||
DefaultDepthOfScreen(XtScreen(shell)));
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
#if 0
|
||||
hideB = XtVaCreateManagedWidget("hide",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XmNleftAttachment, XmATTACH_NONE,
|
||||
XmNtopAttachment, XmATTACH_POSITION,
|
||||
XmNtopPosition, 30,
|
||||
XmNbottomAttachment, XmATTACH_NONE,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
showB = XtVaCreateManagedWidget("show",
|
||||
xmPushButtonWidgetClass, form,
|
||||
XmNleftAttachment, XmATTACH_NONE,
|
||||
XmNtopAttachment, XmATTACH_POSITION,
|
||||
XmNtopPosition, 30,
|
||||
XmNbottomAttachment, XmATTACH_NONE,
|
||||
XmNrightAttachment, XmATTACH_WIDGET,
|
||||
XmNrightWidget, hideB,
|
||||
NULL);
|
||||
#endif /*0*/
|
||||
|
||||
/* Create a Tree with 3 columns and 1 heading row in multiple */
|
||||
/* select mode. We also set globalPixmapWidth and height here */
|
||||
/* which specifys that every Pixmap we set on the Tree will be */
|
||||
/* the size specified (16x16). This will increase performance. */
|
||||
tree = XtVaCreateManagedWidget("tree",
|
||||
xmlTreeWidgetClass, form,
|
||||
XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
|
||||
XtVaTypedArg, XmNforeground, XmRString, "black", 6,
|
||||
XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNselectBackground, XmRString, "#000080", 8,
|
||||
XtVaTypedArg, XmNselectForeground, XmRString, "white", 6,
|
||||
XtVaTypedArg, XmNconnectingLineColor, XmRString, "#808080", 8,
|
||||
XmNhorizontalSizePolicy, XmRESIZE_IF_POSSIBLE,
|
||||
XmNallowColumnResize, True,
|
||||
XmNheadingRows, 1,
|
||||
XmNvisibleRows, 14,
|
||||
XmNcolumns, 3,
|
||||
XmNvisibleColumns, 1,
|
||||
XmNhideUnhideButtons, True,
|
||||
XmNsimpleWidths, "80c 40c 40c",
|
||||
XmNsimpleHeadings, "All Folders|SIZE|DATA2",
|
||||
XmNselectionPolicy, XmSELECT_MULTIPLE_ROW,
|
||||
XmNhighlightRowMode, True,
|
||||
XmNglobalPixmapWidth, 16,
|
||||
XmNglobalPixmapHeight, 16,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
#if 0
|
||||
XmNrightAttachment, XmATTACH_WIDGET,
|
||||
XmNrightWidget, showB,
|
||||
#endif /*0*/
|
||||
XmNdebugLevel, 2,
|
||||
NULL);
|
||||
|
||||
/* Set default values for new cells (the cells in the content rows) */
|
||||
XtVaSetValues(tree,
|
||||
XmNcellDefaults, True,
|
||||
XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
|
||||
XmNcellEditable, True,
|
||||
XmNcellLeftBorderType, XmBORDER_NONE,
|
||||
XmNcellRightBorderType, XmBORDER_NONE,
|
||||
XmNcellTopBorderType, XmBORDER_NONE,
|
||||
XmNcellBottomBorderType, XmBORDER_NONE,
|
||||
NULL);
|
||||
|
||||
#if 0
|
||||
XtAddCallback(hideB, XmNactivateCallback, hide_cb, (XtPointer)tree);
|
||||
XtAddCallback(showB, XmNactivateCallback, show_cb, (XtPointer)tree);
|
||||
#endif /*0*/
|
||||
|
||||
/* Create a TreeRowDefinition array from the data array */
|
||||
/* and add rows to the Tree */
|
||||
n = 11;
|
||||
size = sizeof(XmLTreeRowDefinition) * n;
|
||||
rows = (XmLTreeRowDefinition *)malloc(size);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
rows[i].level = data[i].level;
|
||||
rows[i].expands = data[i].expands;
|
||||
rows[i].isExpanded = True;
|
||||
if (data[i].expands)
|
||||
rows[i].pixmap = spherePixmap;
|
||||
else
|
||||
rows[i].pixmap = monitorPixmap;
|
||||
rows[i].pixmask = XmUNSPECIFIED_PIXMAP;
|
||||
rows[i].string = XmStringCreateSimple(data[i].string);
|
||||
}
|
||||
XmLTreeAddRows(tree, rows, n, -1);
|
||||
|
||||
/* Free the TreeRowDefintion array we created above and set strings */
|
||||
/* in column 1 and 2 */
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
XmStringFree(rows[i].string);
|
||||
XmLGridSetStringsPos(tree, XmCONTENT, i, XmCONTENT, 1, "1032|1123");
|
||||
}
|
||||
free((char *)rows);
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
98
mozilla/cmd/xfe/Microline3.0/examples/uil1.c
Normal file
98
mozilla/cmd/xfe/Microline3.0/examples/uil1.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Mrm/MrmPublic.h>
|
||||
#include <XmL/Folder.h>
|
||||
#include <XmL/Grid.h>
|
||||
#include <XmL/Progress.h>
|
||||
#include <XmL/Tree.h>
|
||||
#include <stdio.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
String argv[];
|
||||
{
|
||||
Display *dpy;
|
||||
XtAppContext app;
|
||||
Widget toplevel, tree, shellForm;
|
||||
Pixmap pixmap;
|
||||
XmString str;
|
||||
MrmHierarchy hier;
|
||||
MrmCode clas;
|
||||
static char *files[] = {
|
||||
"uil1.uid" };
|
||||
|
||||
MrmInitialize ();
|
||||
XtToolkitInitialize();
|
||||
app = XtCreateApplicationContext();
|
||||
dpy = XtOpenDisplay(app, NULL, argv[0], "Uil1",
|
||||
NULL, 0, &argc, argv);
|
||||
if (dpy == NULL) {
|
||||
fprintf(stderr, "%s: Can't open display\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
toplevel = XtVaAppCreateShell(argv[0], NULL,
|
||||
applicationShellWidgetClass, dpy,
|
||||
XmNwidth, 400,
|
||||
XmNheight, 300,
|
||||
NULL);
|
||||
|
||||
if (MrmOpenHierarchy (1, files, NULL, &hier) != MrmSUCCESS)
|
||||
printf ("can't open hierarchy\n");
|
||||
|
||||
MrmRegisterClass(0, NULL, "XmLCreateFolder",
|
||||
XmLCreateFolder, xmlFolderWidgetClass);
|
||||
MrmRegisterClass(0, NULL, "XmLCreateGrid",
|
||||
XmLCreateGrid, xmlGridWidgetClass);
|
||||
MrmRegisterClass(0, NULL, "XmLCreateProgress",
|
||||
XmLCreateProgress, xmlProgressWidgetClass);
|
||||
MrmRegisterClass(0, NULL, "XmLCreateTree",
|
||||
XmLCreateTree, xmlTreeWidgetClass);
|
||||
|
||||
if (MrmFetchWidget(hier, "shellForm", toplevel, &shellForm,
|
||||
&clas) != MrmSUCCESS)
|
||||
printf("can't fetch shellForm\n");
|
||||
|
||||
tree = XtNameToWidget(shellForm, "*tree");
|
||||
|
||||
/* Add two rows to the Tree */
|
||||
pixmap = XmUNSPECIFIED_PIXMAP;
|
||||
str = XmStringCreateSimple("Root");
|
||||
XmLTreeAddRow(tree, 0, True, True, -1, pixmap, pixmap, str);
|
||||
XmStringFree(str);
|
||||
str = XmStringCreateSimple("Child of Root");
|
||||
XmLTreeAddRow(tree, 1, False, False, -1, pixmap, pixmap, str);
|
||||
XmStringFree(str);
|
||||
|
||||
XtManageChild(shellForm);
|
||||
XtRealizeWidget(toplevel);
|
||||
XtAppMainLoop(app);
|
||||
|
||||
return (0);
|
||||
}
|
||||
172
mozilla/cmd/xfe/Microline3.0/examples/uil1.uil
Normal file
172
mozilla/cmd/xfe/Microline3.0/examples/uil1.uil
Normal file
@@ -0,0 +1,172 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
module uil1
|
||||
version = 'v1.0'
|
||||
names = case_sensitive
|
||||
|
||||
include file 'XmL/XmL.uih';
|
||||
|
||||
value
|
||||
grey : color('#C0C0C0', background);
|
||||
lightGrey : color('#E0E0E0', background);
|
||||
black : color('#000000', foreground);
|
||||
white : color('#FFFFFF', background);
|
||||
darkBlue : color('#000080', foreground);
|
||||
|
||||
object shellForm :
|
||||
XmForm {
|
||||
arguments {
|
||||
XmNbackground = grey;
|
||||
XmNmarginWidth = 10;
|
||||
XmNmarginHeight = 10;
|
||||
XmNshadowThickness = 0;
|
||||
};
|
||||
controls {
|
||||
user_defined folder;
|
||||
};
|
||||
};
|
||||
|
||||
object folder :
|
||||
user_defined procedure XmLCreateFolder {
|
||||
arguments {
|
||||
XmNbackground = grey;
|
||||
XmNforeground = black;
|
||||
XmNtabsPerRow = 2;
|
||||
XmNtopAttachment = XmATTACH_FORM;
|
||||
XmNbottomAttachment = XmATTACH_FORM;
|
||||
XmNleftAttachment = XmATTACH_FORM;
|
||||
XmNrightAttachment = XmATTACH_FORM;
|
||||
};
|
||||
controls {
|
||||
XmDrawnButton tabOne;
|
||||
XmDrawnButton tabTwo;
|
||||
XmDrawnButton tabThree;
|
||||
XmDrawnButton tabFour;
|
||||
XmForm folderForm;
|
||||
};
|
||||
};
|
||||
|
||||
object tabOne:
|
||||
XmDrawnButton {
|
||||
arguments {
|
||||
XmNlabelString = compound_string('Configuration');
|
||||
};
|
||||
};
|
||||
|
||||
object tabTwo:
|
||||
XmDrawnButton {
|
||||
arguments {
|
||||
XmNlabelString = compound_string('Settings');
|
||||
};
|
||||
};
|
||||
|
||||
object tabThree:
|
||||
XmDrawnButton {
|
||||
arguments {
|
||||
XmNlabelString = compound_string('Resources');
|
||||
};
|
||||
};
|
||||
|
||||
object tabFour:
|
||||
XmDrawnButton {
|
||||
arguments {
|
||||
XmNlabelString = compound_string('Hardware Types');
|
||||
};
|
||||
};
|
||||
|
||||
object folderForm :
|
||||
XmForm {
|
||||
arguments {
|
||||
XmNbackground = grey;
|
||||
XmNhorizontalSpacing = 10;
|
||||
XmNverticalSpacing = 10;
|
||||
};
|
||||
controls {
|
||||
user_defined tree;
|
||||
user_defined grid;
|
||||
user_defined progress;
|
||||
};
|
||||
};
|
||||
|
||||
object tree :
|
||||
user_defined procedure XmLCreateTree {
|
||||
arguments {
|
||||
XmNbackground = grey;
|
||||
XmNforeground = black;
|
||||
XmNleftAttachment = XmATTACH_FORM;
|
||||
XmNrightAttachment = XmATTACH_FORM;
|
||||
XmNtopAttachment = XmATTACH_FORM;
|
||||
XmNbottomAttachment = XmATTACH_POSITION;
|
||||
XmNbottomPosition = 25;
|
||||
};
|
||||
};
|
||||
|
||||
object grid :
|
||||
user_defined procedure XmLCreateGrid {
|
||||
arguments {
|
||||
XmNbackground = grey;
|
||||
XmNforeground = black;
|
||||
XmNselectBackground = darkBlue;
|
||||
XmNselectForeground = white;
|
||||
XmNleftAttachment = XmATTACH_FORM;
|
||||
XmNrightAttachment = XmATTACH_FORM;
|
||||
XmNtopAttachment = XmATTACH_POSITION;
|
||||
XmNtopPosition = 30;
|
||||
XmNbottomAttachment = XmATTACH_POSITION;
|
||||
XmNbottomPosition = 80;
|
||||
XmNcolumns = 5;
|
||||
XmNheadingRows = 1;
|
||||
XmNsimpleHeadings = "Name|Width|Height|X|Y";
|
||||
XmNsimpleWidths = "20c 10c 10c 8c 8c";
|
||||
XmNrows = 20;
|
||||
XmNleftFixedCount = 1;
|
||||
};
|
||||
};
|
||||
|
||||
object progress :
|
||||
user_defined procedure XmLCreateProgress {
|
||||
arguments {
|
||||
XmNtopShadowColor = lightGrey;
|
||||
XmNbottomShadowColor = black;
|
||||
XmNbackground = white;
|
||||
XmNforeground = darkBlue;
|
||||
XmNleftAttachment = XmATTACH_FORM;
|
||||
XmNrightAttachment = XmATTACH_FORM;
|
||||
XmNtopAttachment = XmATTACH_POSITION;
|
||||
XmNtopPosition = 85;
|
||||
XmNheight = 20;
|
||||
XmNshadowThickness = 1;
|
||||
XmNmeterStyle = MeterBoxes;
|
||||
XmNnumBoxes = 20;
|
||||
XmNvalue = 70;
|
||||
XmNcompleteValue = 200;
|
||||
};
|
||||
};
|
||||
|
||||
end module;
|
||||
87
mozilla/cmd/xfe/Microline3.0/examples/util1.c
Normal file
87
mozilla/cmd/xfe/Microline3.0/examples/util1.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following source code is part of the Microline Widget Library.
|
||||
* The Microline widget library is made available to Mozilla developers
|
||||
* under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
* more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
* http://www.neurondata.com.
|
||||
*/
|
||||
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/DrawnB.h>
|
||||
#include <XmL/XmL.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XtAppContext app;
|
||||
Widget shell, form, button[4][5];
|
||||
int i, j;
|
||||
static int types[5] =
|
||||
{
|
||||
XmDRAWNB_ARROW,
|
||||
XmDRAWNB_ARROWLINE,
|
||||
XmDRAWNB_DOUBLEARROW,
|
||||
XmDRAWNB_SQUARE,
|
||||
XmDRAWNB_DOUBLEBAR
|
||||
};
|
||||
static int dirs[4] =
|
||||
{
|
||||
XmDRAWNB_RIGHT,
|
||||
XmDRAWNB_LEFT,
|
||||
XmDRAWNB_UP,
|
||||
XmDRAWNB_DOWN
|
||||
};
|
||||
|
||||
shell = XtAppInitialize(&app, "Grid1", NULL, 0,
|
||||
&argc, argv, NULL, NULL, 0);
|
||||
|
||||
form = XtVaCreateManagedWidget("form",
|
||||
xmFormWidgetClass, shell,
|
||||
XmNfractionBase, 5,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
|
||||
for (i = 0 ; i < 4; i++)
|
||||
for (j = 0; j < 5; j++)
|
||||
{
|
||||
button[i][j] = XtVaCreateManagedWidget("drawnB",
|
||||
xmDrawnButtonWidgetClass, form,
|
||||
XmNtopAttachment, XmATTACH_POSITION,
|
||||
XmNtopPosition, i,
|
||||
XmNbottomAttachment, XmATTACH_POSITION,
|
||||
XmNbottomPosition, i + 1,
|
||||
XmNleftAttachment, XmATTACH_POSITION,
|
||||
XmNleftPosition, j,
|
||||
XmNrightAttachment, XmATTACH_POSITION,
|
||||
XmNrightPosition, j + 1,
|
||||
XmNwidth, 30,
|
||||
XmNheight, 30,
|
||||
NULL);
|
||||
XmLDrawnButtonSetType(button[i][j], types[j], dirs[i]);
|
||||
}
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XtAppMainLoop(app);
|
||||
}
|
||||
|
||||
52
mozilla/cmd/xfe/Microline3.0/man/XmLArrayAdd.3x
Normal file
52
mozilla/cmd/xfe/Microline3.0/man/XmLArrayAdd.3x
Normal file
@@ -0,0 +1,52 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayAdd 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayAdd \- add space to an array
|
||||
.SH SYNTAX
|
||||
void XmLArrayAdd(\fIarray\fP, \fIpos\fP, \fIcount\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.br
|
||||
int \fIpos\fP;
|
||||
.br
|
||||
int \fIcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to add to
|
||||
.IP \fIpos\fP 1i
|
||||
position to add at
|
||||
.IP \fIcount\fP 1i
|
||||
size of space to add
|
||||
.SH DESCRIPTION
|
||||
Adds (\fIcount\fP * sizeof(void *)) bytes of space at position
|
||||
\fIpos\fP to the \fIarray\fP given. Use XmLArraySet() to set
|
||||
the values in the array after adding space.
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayDel(3X) XmLArrayFree(3X) XmLArrayGet(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayMove(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
54
mozilla/cmd/xfe/Microline3.0/man/XmLArrayDel.3x
Normal file
54
mozilla/cmd/xfe/Microline3.0/man/XmLArrayDel.3x
Normal file
@@ -0,0 +1,54 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayDel 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayDel \- remove space from an array
|
||||
.SH SYNTAX
|
||||
int XmLArrayDel(\fIarray\fP, \fIpos\fP, \fIcount\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.br
|
||||
int \fIpos\fP;
|
||||
.br
|
||||
int \fIcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to remove from
|
||||
.IP \fIpos\fP 1i
|
||||
position to start removal
|
||||
.IP \fIcount\fP 1i
|
||||
size of space to remove
|
||||
.SH DESCRIPTION
|
||||
Removes (\fIcount\fP * sizeof(void *)) bytes of space at position
|
||||
\fIpos\fP from the \fIarray\fP given. This call only removes
|
||||
space from the array, it does not free individual elements.
|
||||
.SH RETURN VALUE
|
||||
0 upon success and -1 upon failure (a value passed is out of range).
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayFree(3X) XmLArrayGet(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayMove(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
43
mozilla/cmd/xfe/Microline3.0/man/XmLArrayFree.3x
Normal file
43
mozilla/cmd/xfe/Microline3.0/man/XmLArrayFree.3x
Normal file
@@ -0,0 +1,43 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayFree 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayFree \- free an array
|
||||
.SH SYNTAX
|
||||
void XmLArrayFree(\fIarray\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to free
|
||||
.SH DESCRIPTION
|
||||
Frees the \fIarray\fP given and any space allocated by the array.
|
||||
This function does not free the individual elements of the array.
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayGet(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayMove(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
48
mozilla/cmd/xfe/Microline3.0/man/XmLArrayGet.3x
Normal file
48
mozilla/cmd/xfe/Microline3.0/man/XmLArrayGet.3x
Normal file
@@ -0,0 +1,48 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayGet 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayGet \- retrieve a pointer from an array
|
||||
.SH SYNTAX
|
||||
void *XmLArrayGet(\fIarray\fP, \fIpos\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.br
|
||||
int \fIpos\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to retrieve from
|
||||
.IP \fIpos\fP 1i
|
||||
position of the pointer to retrieve
|
||||
.SH DESCRIPTION
|
||||
Returns the pointer at the position \fIpos\fP in the \fIarray\fP given.
|
||||
.SH RETURN VALUE
|
||||
The pointer at the given position or NULL if the position is invalid.
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayFree(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayMove(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
44
mozilla/cmd/xfe/Microline3.0/man/XmLArrayGetCount.3x
Normal file
44
mozilla/cmd/xfe/Microline3.0/man/XmLArrayGetCount.3x
Normal file
@@ -0,0 +1,44 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayGetCount 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayGetCount \- return size of an array
|
||||
.SH SYNTAX
|
||||
int XmLArrayGetCount(\fIarray\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to query
|
||||
.SH DESCRIPTION
|
||||
Returns the size of \fIarray\fP in units of number of pointers it can hold.
|
||||
.SH RETURN VALUE
|
||||
The size of the array.
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayFree(3X) XmLArrayGet(3X)
|
||||
XmLArrayMove(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
60
mozilla/cmd/xfe/Microline3.0/man/XmLArrayMove.3x
Normal file
60
mozilla/cmd/xfe/Microline3.0/man/XmLArrayMove.3x
Normal file
@@ -0,0 +1,60 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayMove 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayMove \- move items in an array
|
||||
.SH SYNTAX
|
||||
int XmLArrayMove(\fIarray\fP, \fInewPos\fP, \fIpos\fP, \fIcount\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.br
|
||||
int \fInewPos\fP;
|
||||
.br
|
||||
int \fIpos\fP;
|
||||
.br
|
||||
int \fIcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to operate on
|
||||
.IP \fInewPos\fP 1i
|
||||
position to move to
|
||||
.IP \fIpos\fP 1i
|
||||
position to move from
|
||||
.IP \fIcount\fP 1i
|
||||
number of items to move
|
||||
.SH DESCRIPTION
|
||||
Moves \fIcount\fP pointers starting at position \fIpos\fP in the
|
||||
\fIarray\fP to the new position \fInewPos\fP. The existing pointers
|
||||
at the new location are moved down to accommodate the move. No pointers
|
||||
are overwritten by this call and the size of the array will remain
|
||||
unchanged.
|
||||
.SH RETURN VALUE
|
||||
0 upon success and -1 upon failure (a value passed is out of range).
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayFree(3X) XmLArrayGet(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
60
mozilla/cmd/xfe/Microline3.0/man/XmLArrayNew.3x
Normal file
60
mozilla/cmd/xfe/Microline3.0/man/XmLArrayNew.3x
Normal file
@@ -0,0 +1,60 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayNew 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayNew \- creates an array object
|
||||
.SH SYNTAX
|
||||
XmLArray XmLArrayNew(\fIautonumber\fP, \fIgrowFast\fP)
|
||||
.br
|
||||
char \fIautonumber\fP;
|
||||
.br
|
||||
char \fIgrowFast\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIautonumber\fP 1i
|
||||
If set to 1, the pointers in the array are assumed to be
|
||||
pointers to structures containing an integer as the first
|
||||
element which will be set to the position of the item
|
||||
in the array. The array will set this value with the
|
||||
current position of the element whenever position
|
||||
of the item changes. If set to 0, the array will never
|
||||
dereference the pointers contained in the array.
|
||||
.IP \fIgrowFast\fP 1i
|
||||
If set to 1, the array will grow quickly as items are added
|
||||
to it. This will cause the amount of memory the array takes
|
||||
up to usually be greater than the current space for elements.
|
||||
If set to 0, the array will always be the size of the current
|
||||
space for the elements contained in the array.
|
||||
.SH DESCRIPTION
|
||||
Creates an array object and returns it. An array object is used to
|
||||
hold an array of pointers. This object should be freed with XmLArrayFree()
|
||||
when it is no longer used.
|
||||
.SH RETURN VALUE
|
||||
The newly allocate array object.
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayFree(3X) XmLArrayGet(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayMove(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
60
mozilla/cmd/xfe/Microline3.0/man/XmLArrayReorder.3x
Normal file
60
mozilla/cmd/xfe/Microline3.0/man/XmLArrayReorder.3x
Normal file
@@ -0,0 +1,60 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArrayReorder 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArrayReorder \- reorder items in an array
|
||||
.SH SYNTAX
|
||||
int XmLArrayReorder(\fIarray\fP, \fInewPositions\fP, \fIpos\fP, \fIcount\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.br
|
||||
int \fInewPositions\fP;
|
||||
.br
|
||||
int \fIpos\fP;
|
||||
.br
|
||||
int \fIcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to operate on
|
||||
.IP \fInewPositions\fP 1i
|
||||
new positions of items
|
||||
.IP \fIpos\fP 1i
|
||||
start position of items to reorder
|
||||
.IP \fIcount\fP 1i
|
||||
number of items to reorder
|
||||
.SH DESCRIPTION
|
||||
Reorders the \fIarray\fP by ordering \fIcount\fP pointers at position
|
||||
\fIpos\fP to the positions specified in the \fInewPositions\fP array.
|
||||
The newPositions array should contain numbers starting at pos and
|
||||
ending at pos + count - 1. This function does not free the newPositions
|
||||
array passed in.
|
||||
.SH RETURN VALUE
|
||||
0 upon success and -1 upon failure (a value passed is out of range).
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayFree(3X) XmLArrayGet(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
54
mozilla/cmd/xfe/Microline3.0/man/XmLArraySet.3x
Normal file
54
mozilla/cmd/xfe/Microline3.0/man/XmLArraySet.3x
Normal file
@@ -0,0 +1,54 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArraySet 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArraySet \- set a pointer element in an array
|
||||
.SH SYNTAX
|
||||
int XmLArraySet(\fIarray\fP, \fIpos\fP, \fIitem\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.br
|
||||
int \fIpos\fP;
|
||||
.br
|
||||
void *\fIitem\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
array to set in
|
||||
.IP \fIpos\fP 1i
|
||||
position of the pointer to set
|
||||
.IP \fIitem\fP 1i
|
||||
value of the item to set
|
||||
.SH DESCRIPTION
|
||||
Sets the pointer at the position \fIpos\fP in the \fIarray\fP given to
|
||||
\fIitem\fP.
|
||||
.SH RETURN VALUE
|
||||
0 upon success and -1 upon failure (a value passed is out of range).
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayFree(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayMove(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X) XmLArraySort(3X)
|
||||
|
||||
64
mozilla/cmd/xfe/Microline3.0/man/XmLArraySort.3x
Normal file
64
mozilla/cmd/xfe/Microline3.0/man/XmLArraySort.3x
Normal file
@@ -0,0 +1,64 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLArraySort 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLArraySort \- sort an array
|
||||
.SH SYNTAX
|
||||
int XmLArraySort(\fIarray\fP, \fIcompare\fP, \fIuserData\fP, \
|
||||
\fIpos\fP, \fIcount\fP)
|
||||
.br
|
||||
XmLArray \fIarray\fP;
|
||||
.br
|
||||
XmLArrayCompareFunc \fIcompare\fP;
|
||||
.br
|
||||
void *\fIuserData\fP;
|
||||
.br
|
||||
int \fIpos\fP;
|
||||
.br
|
||||
int \fIcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIarray\fP 1i
|
||||
the array to sort
|
||||
.IP \fIcompare\fP 1i
|
||||
the comparison function for pointers in the array
|
||||
.IP \fIuserData\fP 1i
|
||||
an application defined pointer to pass to the sort function
|
||||
.IP \fIpos\fP 1i
|
||||
start position in array to sort
|
||||
.IP \fIcount\fP 1i
|
||||
number of items in array to sort
|
||||
.SH DESCRIPTION
|
||||
Sorts \fIcount\fP number of elements starting at position
|
||||
\fIpos\fP in \fIarray\fP using the \fIcompare\fP function given.
|
||||
The \fIuserData\fP argument is passed as data to the comparison
|
||||
function.
|
||||
.SH RETURN VALUE
|
||||
0 upon success and -1 upon failure (a value passed is out of range).
|
||||
.SH "SEE ALSO"
|
||||
XmLArrayAdd(3X) XmLArrayDel(3X) XmLArrayFree(3X) XmLArrayGet(3X)
|
||||
XmLArrayGetCount(3X) XmLArrayMove(3X) XmLArrayNew(3X)
|
||||
XmLArrayReorder(3X) XmLArraySet(3X)
|
||||
54
mozilla/cmd/xfe/Microline3.0/man/XmLCreateFolder.3x
Normal file
54
mozilla/cmd/xfe/Microline3.0/man/XmLCreateFolder.3x
Normal file
@@ -0,0 +1,54 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLCreateFolder 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLCreateFolder \- create an instance of a Folder widget
|
||||
.SH SYNTAX
|
||||
Widget XmLCreateFolder(\fIparent\fP, \fIname\fP, \fIarglist\fP, \fIargcount\fP)
|
||||
.br
|
||||
Widget \fIparent\fP;
|
||||
.br
|
||||
char *\fIname\fP;
|
||||
.br
|
||||
ArgList \fIarglist\fP;
|
||||
.br
|
||||
Cardinal \fIargcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIparent\fP 1i
|
||||
new widgets parent widget ID
|
||||
.IP \fIname\fP 1i
|
||||
name of the newly created widget
|
||||
.IP \fIarglist\fP 1i
|
||||
resource name/value pairs
|
||||
.IP \fIargcount\fP 1i
|
||||
count of pairs in arglist
|
||||
.SH DESCRIPTION
|
||||
Creates an instance of a Folder widget and returns its widget ID.
|
||||
.SH RETURN VALUE
|
||||
The widget ID of the newly created Folder widget.
|
||||
.SH "SEE ALSO"
|
||||
XmLFolder(3X)
|
||||
54
mozilla/cmd/xfe/Microline3.0/man/XmLCreateGrid.3x
Normal file
54
mozilla/cmd/xfe/Microline3.0/man/XmLCreateGrid.3x
Normal file
@@ -0,0 +1,54 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLCreateGrid 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLCreateGrid \- create an instance of a Grid widget
|
||||
.SH SYNTAX
|
||||
Widget XmLCreateGrid(\fIparent\fP, \fIname\fP, \fIarglist\fP, \fIargcount\fP)
|
||||
.br
|
||||
Widget \fIparent\fP;
|
||||
.br
|
||||
char *\fIname\fP;
|
||||
.br
|
||||
ArgList \fIarglist\fP;
|
||||
.br
|
||||
Cardinal \fIargcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIparent\fP 1i
|
||||
new widgets parent widget ID
|
||||
.IP \fIname\fP 1i
|
||||
name of the newly created widget
|
||||
.IP \fIarglist\fP 1i
|
||||
resource name/value pairs
|
||||
.IP \fIargcount\fP 1i
|
||||
count of pairs in arglist
|
||||
.SH DESCRIPTION
|
||||
Creates an instance of a Grid widget and returns its widget ID.
|
||||
.SH RETURN VALUE
|
||||
The widget ID of the newly created Grid widget.
|
||||
.SH "SEE ALSO"
|
||||
XmLGrid(3X)
|
||||
55
mozilla/cmd/xfe/Microline3.0/man/XmLCreateProgress.3x
Normal file
55
mozilla/cmd/xfe/Microline3.0/man/XmLCreateProgress.3x
Normal file
@@ -0,0 +1,55 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLCreateProgress 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLCreateProgress \- create an instance of a Progress widget
|
||||
.SH SYNTAX
|
||||
Widget XmLCreateProgress(\fIparent\fP, \fIname\fP, \fIarglist\fP,
|
||||
\fIargcount\fP)
|
||||
.br
|
||||
Widget \fIparent\fP;
|
||||
.br
|
||||
char *\fIname\fP;
|
||||
.br
|
||||
ArgList \fIarglist\fP;
|
||||
.br
|
||||
Cardinal \fIargcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIparent\fP 1i
|
||||
new widgets parent widget ID
|
||||
.IP \fIname\fP 1i
|
||||
name of the newly created widget
|
||||
.IP \fIarglist\fP 1i
|
||||
resource name/value pairs
|
||||
.IP \fIargcount\fP 1i
|
||||
count of pairs in arglist
|
||||
.SH DESCRIPTION
|
||||
Creates an instance of a Progress widget and returns its widget ID.
|
||||
.SH RETURN VALUE
|
||||
The widget ID of the newly created Progress widget.
|
||||
.SH "SEE ALSO"
|
||||
XmLProgress(3X)
|
||||
54
mozilla/cmd/xfe/Microline3.0/man/XmLCreateTree.3x
Normal file
54
mozilla/cmd/xfe/Microline3.0/man/XmLCreateTree.3x
Normal file
@@ -0,0 +1,54 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLCreateTree 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLCreateTree \- create an instance of a Tree widget
|
||||
.SH SYNTAX
|
||||
Widget XmLCreateTree(\fIparent\fP, \fIname\fP, \fIarglist\fP, \fIargcount\fP)
|
||||
.br
|
||||
Widget \fIparent\fP;
|
||||
.br
|
||||
char *\fIname\fP;
|
||||
.br
|
||||
ArgList \fIarglist\fP;
|
||||
.br
|
||||
Cardinal \fIargcount\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIparent\fP 1i
|
||||
new widgets parent widget ID
|
||||
.IP \fIname\fP 1i
|
||||
name of the newly created widget
|
||||
.IP \fIarglist\fP 1i
|
||||
resource name/value pairs
|
||||
.IP \fIargcount\fP 1i
|
||||
count of pairs in arglist
|
||||
.SH DESCRIPTION
|
||||
Creates an instance of a Tree widget and returns its widget ID.
|
||||
.SH RETURN VALUE
|
||||
The widget ID of the newly created Tree widget.
|
||||
.SH "SEE ALSO"
|
||||
XmLTree(3X)
|
||||
65
mozilla/cmd/xfe/Microline3.0/man/XmLCvtStringToUChar.3x
Normal file
65
mozilla/cmd/xfe/Microline3.0/man/XmLCvtStringToUChar.3x
Normal file
@@ -0,0 +1,65 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLCvtStringToUChar 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLCvtStringToUChar \- unsigned char resource converter
|
||||
.SH SYNTAX
|
||||
Boolean XmLCvtStringToUChar(\fIdpy\fP, \fIresname\fP, \fImap\fP, \
|
||||
\fIfromVal\fP, \fItoVal\fP)
|
||||
.br
|
||||
Display *\fIdpy\fP;
|
||||
.br
|
||||
char *\fIresname\fP;
|
||||
.br
|
||||
XmLStringToUCharMap *\fImap\fP;
|
||||
.br
|
||||
XrmValuePtr \fIfromVal\fP;
|
||||
.br
|
||||
XrmValuePtr \fItoVal\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIdpy\fP 1i
|
||||
the display
|
||||
.IP \fIresname\fP 1i
|
||||
the resource name
|
||||
.IP \fImap\fP 1i
|
||||
the mappings of string to unsigned char
|
||||
.IP \fIfromVal\fP 1i
|
||||
the resource value from
|
||||
.IP \fItoVal\fP 1i
|
||||
the resource value to
|
||||
.SH DESCRIPTION
|
||||
This function can be used in a widget to perform resource conversion
|
||||
from a string to an unsigned char. This function should be called inside
|
||||
a widgets resource converter where parameters \fIdpy\fP,
|
||||
\fIfromVal\fP and \fItoVal\fP are available to be passed in. The
|
||||
\fIresname\fP parameter identifies the resource and the \fImap\fP
|
||||
array is an array of mappings from strings to unsigned chars. A
|
||||
NULL string should be used in the last array element to terminate
|
||||
the array.
|
||||
.SH RETURN VALUE
|
||||
True if conversion was successful and toVal is filled in and False if
|
||||
conversion was unsuccessful.
|
||||
47
mozilla/cmd/xfe/Microline3.0/man/XmLDateDaysInMonth.3x
Normal file
47
mozilla/cmd/xfe/Microline3.0/man/XmLDateDaysInMonth.3x
Normal file
@@ -0,0 +1,47 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLDateDaysInMonth 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLDateDaysInMonth \- calculates number of days in month
|
||||
.SH SYNTAX
|
||||
int XmLDateDaysInMonth(\fIm\fP, \fIy\fP)
|
||||
.br
|
||||
int \fIm\fP;
|
||||
.br
|
||||
int \fIy\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIm\fP 1i
|
||||
month 1 to 12
|
||||
.IP \fIy\fP 1i
|
||||
year 1753 to 9999
|
||||
.SH DESCRIPTION
|
||||
Calculates the number of days in a given month \fIm\fP and year \fIy\fP.
|
||||
.SH RETURN VALUE
|
||||
The number of days in the given month and year. A value of -1 is
|
||||
returned if a passed value is out of range.
|
||||
.SH "SEE ALSO"
|
||||
XmLDateWeekDay(3X)
|
||||
52
mozilla/cmd/xfe/Microline3.0/man/XmLDateWeekDay.3x
Normal file
52
mozilla/cmd/xfe/Microline3.0/man/XmLDateWeekDay.3x
Normal file
@@ -0,0 +1,52 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLDateWeekDay 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLDateWeekDay \- calculates the weekday for a given date
|
||||
.SH SYNTAX
|
||||
int XmLDateWeekDay(\fIm\fP, \fId\fP, \fIy\fP)
|
||||
.br
|
||||
int \fIm\fP;
|
||||
.br
|
||||
int \fId\fP;
|
||||
.br
|
||||
int \fIy\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIm\fP 1i
|
||||
month 1 to 12
|
||||
.IP \fId\fP 1i
|
||||
day 1 to number of days in month
|
||||
.IP \fIy\fP 1i
|
||||
year 1753 to 9999
|
||||
.SH DESCRIPTION
|
||||
Calculates the weekday for the given day \fId\fP, month \fIm\fP, and year
|
||||
\fIy\fP.
|
||||
.SH RETURN VALUE
|
||||
0 for Sunday, 1 for Monday and so on through 6 for Saturday. A value
|
||||
of -1 is returned if a passed value is out of range.
|
||||
.SH "SEE ALSO"
|
||||
XmLDateDaysInMonth(3X)
|
||||
54
mozilla/cmd/xfe/Microline3.0/man/XmLDrawnButtonSetType.3x
Normal file
54
mozilla/cmd/xfe/Microline3.0/man/XmLDrawnButtonSetType.3x
Normal file
@@ -0,0 +1,54 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLDrawnButtonSetType 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLDrawnButtonSetType \- adds graphics to a DrawnButton widget
|
||||
.SH SYNTAX
|
||||
void XmLDrawnButtonSetType(\fIwidget\fP, \fIdrawnType\fP, \fIdrawnDir\fP)
|
||||
.br
|
||||
Widget \fIwidget\fP;
|
||||
.br
|
||||
int \fIdrawnType\fP;
|
||||
.br
|
||||
int \fIdrawnDir\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIwidget\fP 1i
|
||||
DrawnButton widget ID
|
||||
.IP \fIdrawnType\fP 1i
|
||||
type of button to display
|
||||
.IP \fIdrawnDir\fP 1i
|
||||
direction of button to display
|
||||
.SH DESCRIPTION
|
||||
Given a \fIwidget\fP of class XmDrawnButton this function attaches
|
||||
expose and realize callbacks to the widget to display the specified graphic
|
||||
in the button. This function also sets the widget's XmNpushButtonEnabled
|
||||
resource to True. The \fIdrawnType\fP value given must be one of
|
||||
the following: XmDRAWNB_ARROW, XmDRAWNB_ARROWLINE, XmDRAWNB_DOUBLEARROW,
|
||||
XmDRAWNB_SQUARE ,XmDRAWNB_DOUBLEBAR or XmDRAWNB_STRING.
|
||||
The \fIdrawnDir\fP value given must be
|
||||
XmDRAWNB_RIGHT, XmDRAWNB_LEFT, XmDRAWNB_UP, or XmDRAWNB_DOWN.
|
||||
The graphics inside the button are drawn in the widget's foreground color.
|
||||
352
mozilla/cmd/xfe/Microline3.0/man/XmLFolder.3x
Normal file
352
mozilla/cmd/xfe/Microline3.0/man/XmLFolder.3x
Normal file
@@ -0,0 +1,352 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLFolder 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLFolder
|
||||
.SH SYNOPSIS
|
||||
#include <XmL/Folder.h>
|
||||
.LP
|
||||
.SH DESCRIPTION
|
||||
Provides a Folder containing tabs along the top, bottom, left or
|
||||
right and an area managed by the tabs in the center. Each tab
|
||||
consists of a Primitive widget surrounded by tab decorations including
|
||||
an optional pixmap. Any non-Primitive widget children of the Folder
|
||||
are placed in the center area. The widgets contained in the tabs
|
||||
can be assigned a non-Primitive widget to display/manage when the
|
||||
tab widget is selected.
|
||||
.SS Class Information
|
||||
Folder inherits from XmManager, Constraint, Composite and Core. Its
|
||||
class pointer is xmlFolderWidgetClass. Its class name is XmLFolder.
|
||||
.SS New Resources
|
||||
|
||||
.nf
|
||||
.ft B
|
||||
Name Class
|
||||
Type Default Access
|
||||
.ft P
|
||||
XmNactiveTab XmCActiveTab
|
||||
int -1 G
|
||||
XmNautoSelect XmCAutoSelect
|
||||
Boolean True CSG
|
||||
XmNblankBackground XmCBlankBackground
|
||||
Pixel dynamic CSG
|
||||
XmNblankBackgroundPixmap XmCBlankBackgroundPixmap
|
||||
Pixmap dynamic CSG
|
||||
XmNcornerDimension XmCCornerDimension
|
||||
Dimension 2 CSG
|
||||
XmNcornerStyle XmCCornerStyle
|
||||
unsigned char XmCORNER_ARC CSG
|
||||
XmNdebugLevel XmCDebugLevel
|
||||
int 0 CSG
|
||||
XmNfontList XmCFontList
|
||||
XmFontList dynamic CSG
|
||||
XmNhighlightThickness XmCHighlightThickness
|
||||
Dimension 2 CSG
|
||||
XmNinactiveBackground XmCInactiveBackground
|
||||
Pixel dynamic CSG
|
||||
XmNinactiveForeground XmCInactiveForeground
|
||||
Pixel dynamic CSG
|
||||
XmNmarginHeight XmCMarginHeight
|
||||
Dimension 0 CSG
|
||||
XmNmarginWidth XmCMarginWidth
|
||||
Dimension 0 CSG
|
||||
XmNpixmapMargin XmCPixmapMargin
|
||||
Dimension 2 CSG
|
||||
XmNresizePolicy XmCFolderResizePolicy
|
||||
XmRFolderResizePolicy XmRESIZE_STATIC CSG
|
||||
XmNrotateWhenLeftRight XmCRotateWhenLeftRight
|
||||
Boolean True CSG
|
||||
XmNspacing XmCSpacing
|
||||
Dimension 0 CSG
|
||||
XmNtabBarHeight XmCTabBarHeight
|
||||
Dimension dynamic G
|
||||
XmNtabCount XmCTabCount
|
||||
int 0 G
|
||||
XmNtabPlacement XmCTabPlacement
|
||||
unsigned char XmFOLDER_TOP CSG
|
||||
XmNtabsPerRow XmCTabsPerRow
|
||||
int 0 CSG
|
||||
XmNtabTranslations XmCTranslations
|
||||
XtTranslations [focus translations] CG
|
||||
XmNtabWidgetList XmCReadOnly
|
||||
WidgetList dynamic G
|
||||
.fi
|
||||
.IP XmNactiveTab
|
||||
The position of the currently active tab. The first tab on the
|
||||
left has a position of 0. If no tab is active, this value equals -1.
|
||||
.IP XmNautoSelect
|
||||
If True (the default), the Folder will activate its first tab
|
||||
when it is realized. No callback is generated by this action.
|
||||
If False, no initial tab will be activated.
|
||||
.IP XmNblankBackground
|
||||
The color of the area between tabs, around tabs, and between
|
||||
tabs and the edge of the Folder.
|
||||
.IP XmNblankBackgroundPixmap
|
||||
The pixmap to display as a background (tiled) in the blank background
|
||||
area. See XmNblankBackground.
|
||||
.IP XmNcornerDimension
|
||||
If XmNcornerStyle is XmCORNER_LINE, this value is used to determine
|
||||
the length of the lines that clip the corners of the tabs. The
|
||||
greater this value is, the longer the corner lines will be. If
|
||||
XmNcornerStyle is XmCORNER_ARC, this value is used to determine
|
||||
the sizes of the arcs in the corners of the tabs. If XmNcornerStyle
|
||||
is XmCORNER_NONE, this resource has no effect.
|
||||
.IP XmNcornerStyle
|
||||
Defines the type of corners on the individual tabs. Possible values:
|
||||
|
||||
.nf
|
||||
XmCORNER_NONE /* no corners */
|
||||
XmCORNER_LINE /* corners are beveled */
|
||||
XmCORNER_ARC /* corners are round */
|
||||
.fi
|
||||
.IP XmNdebugLevel
|
||||
If set to a value greater than 0, debugging messages will be
|
||||
printed to stderr. When set to 0 (the default) only error
|
||||
messages will be generated.
|
||||
.IP XmNfontList
|
||||
The default font list for tabs created with the XmLFolderAddTab()
|
||||
functions. Changing this value does not affect existing widgets.
|
||||
If this value is NULL, a font list is obtained from the nearest
|
||||
parent that is a subclass of BulletinBoard, MenuShell, or VendorShell.
|
||||
.IP XmNhighlightThickness
|
||||
The thickness of the highlight drawn around the Primitive widget
|
||||
contained in the active tab. When a Primitive widget is added to
|
||||
the Folder, its highlightThickness is set to 0. The Folder is
|
||||
responsible for drawing the highlight in the active tab.
|
||||
This is necessary because if the Primitive widget were allowed
|
||||
to draw the highlight, it would erase the highlight with
|
||||
an incorrect color.
|
||||
.IP XmNinactiveBackground
|
||||
The background color of inactive tabs. This value is initially set
|
||||
to the background color of the Folder widget.
|
||||
.IP XmNinactiveForeground
|
||||
The foreground color of inactive tabs. This value is initially
|
||||
set to the foreground color of the Folder widget.
|
||||
.IP XmNmarginHeight
|
||||
If tab placement is on the top or bottom, this value is the margin
|
||||
between tab widgets and the top of tabs, and between tab widgets
|
||||
and the bottom of tabs. If tab placement is on the left or right,
|
||||
this value is the margin between tab widgets and the left of tabs,
|
||||
and between tab widgets and the right of tabs.
|
||||
.IP XmNmarginWidth
|
||||
If tab placement is on the top or bottom, this value is the margin
|
||||
between tab widgets and the left of tabs, and between tab widgets
|
||||
and the right of tabs. If tab placement is on the left
|
||||
or right, this value is the margin between tab widgets and the top of
|
||||
tabs and between tab widgets and bottoms of tabs.
|
||||
.IP XmNpixmapMargin
|
||||
The margin between the tab widget and any pixmap to its left.
|
||||
.IP XmNresizePolicy
|
||||
This policy determines when the Folder should perform a request
|
||||
for a new size from its parent.
|
||||
A policy of XmRESIZE_STATIC (the default) will cause the Folder
|
||||
to initially request a size which includes the preferred size of
|
||||
its children and then reject any subsequent resize requests from
|
||||
its non-tab widget children. A policy of XmRESIZE_DYNAMIC will
|
||||
cause the Folder to resize itself to include the preferred size
|
||||
of any of its children whenever its children change size. A
|
||||
policy of XmRESIZE_NONE will cause the Folder to never generate
|
||||
a resize request and also will cause it not to perform geometry
|
||||
management on its non-tab widget children. Possible values:
|
||||
|
||||
.nf
|
||||
XmRESIZE_NONE /* no resize requests and no
|
||||
placement or geometry management
|
||||
of non-tab children */
|
||||
XmRESIZE_STATIC /* initially layout to include
|
||||
preferred size of children */
|
||||
XmRESIZE_DYNAMIC /* dynamically resize as children
|
||||
request new size */
|
||||
.fi
|
||||
.IP XmNrotateWhenLeftRight
|
||||
If True, XmDrawnButton based tabs (including tabs created with the
|
||||
XmLFolderAddTab() functions) will display their text vertically
|
||||
instead of horizontally if they are placed on the left or right
|
||||
of the Folder. This occurs when the Folder's XmNtabPlacement
|
||||
resource is XmFOLDER_LEFT or XmFOLDER_RIGHT. Tabs on the
|
||||
left would have their text drawn up and tabs on the right
|
||||
would have their text drawn down. If False, tabs are left
|
||||
oriented horizontally regardless of their placement.
|
||||
.IP XmNspacing
|
||||
The amount of space between tabs.
|
||||
.IP XmNtabBarHeight
|
||||
The height, in pixels, of the tab bar. If tab placement is on
|
||||
the left or right, this value is the width of the tab bar.
|
||||
This value may not be set and is only valid after the Folder
|
||||
has been managed and has performed its layout.
|
||||
.IP XmNtabCount
|
||||
The number of tabs displayed.
|
||||
.IP XmNtabPlacement
|
||||
Where to place the tabs. Possible values:
|
||||
|
||||
.nf
|
||||
XmFOLDER_TOP /* top left to right */
|
||||
XmFOLDER_BOTTOM /* bottom left to right */
|
||||
XmFOLDER_LEFT /* left top to bottom */
|
||||
XmFOLDER_RIGHT /* right top to bottom */
|
||||
.fi
|
||||
.IP XmNtabsPerRow
|
||||
If set to 0 (the default), the Folder will place tabs in a
|
||||
single row one after another during layout. If non-zero,
|
||||
this value specifies the number of rows of tabs to appear
|
||||
in the Folder and the Folder will pad each row to the width
|
||||
of the Folder by proportionally sizing the tabs based on
|
||||
their contents and the width of the row.
|
||||
.IP XmNtabTranslations
|
||||
The translation table used to augment the translations of
|
||||
Primitive widgets added to the Folder. The Folder overrides
|
||||
the FocusIn and FocusOut translations of its Primitive widget
|
||||
children allowing it to draw and erase tab highlights.
|
||||
.IP XmNtabWidgetList
|
||||
The list of widgets contained inside the tabs. These widgets
|
||||
are subclasses of XmPrimitive.
|
||||
.SS Constraint Resources
|
||||
Folder defines the following constraint resources.
|
||||
|
||||
.nf
|
||||
.ft B
|
||||
Name Class
|
||||
Type Default Access
|
||||
.ft P
|
||||
XmNtabFreePixmaps XmCTabFreePixmap
|
||||
Boolean False CSG
|
||||
XmNtabInactivePixmap XmCTabInactivePixmap
|
||||
Pixmap XmUNSPECIFIED_PIXMAP CSG
|
||||
XmNtabManagedName XmCTabManagedName
|
||||
String NULL CSG
|
||||
XmNtabManagedWidget XmCTabManagedWidget
|
||||
Widget NULL CSG
|
||||
XmNtabPixmap XmCTabPixmap
|
||||
Pixmap XmUNSPECIFIED_PIXMAP CSG
|
||||
.fi
|
||||
.IP XmNtabFreePixmaps
|
||||
If True, the Folder will call XFreePixmap on the XmNtabPixmap and
|
||||
XmNtabInactivePixmap pixmaps when this widget is destroyed.
|
||||
This value is set to True for tabs created by the
|
||||
XmLFolderAddBitmapTab() functions.
|
||||
.IP XmNtabInactivePixmap
|
||||
The pixmap to appear in the left of the tab when the tab is inactive.
|
||||
.IP XmNtabManagedName
|
||||
By setting a managed name on a tab widget and setting the same
|
||||
managed name on a Manager widget, you specify that the tab
|
||||
manages the Manager widget. You can also specify that a tab
|
||||
manages a specific Manager widget by setting the managed name
|
||||
on the tab widget to the name (XtName) of the Manager widget.
|
||||
If a tab widget has a managed name, the XmNtabManagedWidget
|
||||
resource of the tab widget is ignored.
|
||||
.IP XmNtabManagedWidget
|
||||
Specifies a widget to be managed when this widget is activated.
|
||||
When this widget is deactivated, its managed widget will be
|
||||
unmanaged. This resource allows Manager widgets contained in the
|
||||
center of the Folder to be attached to tabs, so when a user
|
||||
selects a tab its attached Manager widget will be displayed on
|
||||
the screen.
|
||||
.IP XmNtabPixmap
|
||||
The pixmap to appear in the left of the tab when the tab is active.
|
||||
.SS Callback Resources
|
||||
Folder defines the following callback resources.
|
||||
|
||||
.nf
|
||||
.ft B
|
||||
Callback Reason
|
||||
.ft P
|
||||
XmNactivateCallback XmCR_ACTIVATE
|
||||
.fi
|
||||
.SS Callback Structure
|
||||
Each callback function is passed a pointer to the structure shown below.
|
||||
|
||||
.nf
|
||||
typedef struct
|
||||
{
|
||||
int reason; /* callback reason */
|
||||
XEvent *event; /* event callback or NULL */
|
||||
int pos; /* position of tab to act */
|
||||
int allowActivate; /* allow/disallow act (1/0) */
|
||||
} XmLFolderCallbackStruct;
|
||||
.fi
|
||||
|
||||
pos will be set to the position of the tab (with 0 as the first tab
|
||||
on the left) to activate for XmNactivateCallback callbacks.
|
||||
If allowActivate is set to 0 by the callback function, the tab will not
|
||||
be activated and the attempt to activate the given tab will be rejected.
|
||||
.SS Inherited Resources
|
||||
Folder inherits the resources shown below.
|
||||
|
||||
.nf
|
||||
.ft B
|
||||
Resource From Resource From
|
||||
.ft P
|
||||
XmNaccelerators Core XmNinitialResourcePersist Core
|
||||
XmNancestorSensitive Core XmNinsertPosition Composite
|
||||
XmNbackground Core XmNmappedWhenManaged Core
|
||||
XmNbackgroundPixmap Core XmNnavagationType Manager
|
||||
XmNborderColor Core XmNnumChildren Composite
|
||||
XmNborderPixmap Core XmNscreen Core
|
||||
XmNborderWidth Core XmNsensitive Core
|
||||
XmNbottomShadowColor Manager XmNshadowThicknses Manager
|
||||
XmNbottomShadowPixmap Manager XmNstringDirection Manager
|
||||
XmNchildren Composite XmNtopShadowColor Manager
|
||||
XmNcolormap Core XmNtopShadowPixmap Manager
|
||||
XmNdepth Core XmNtranslations Core
|
||||
XmNdestroyCallback Core XmNtraversalOn Manager
|
||||
XmNforeground Manager XmNunitType Manager
|
||||
XmNheight Core XmNuserData Manager
|
||||
XmNhelpCallback Manager XmNwidth Core
|
||||
XmNhighlightColor Manager XmNx Core
|
||||
XmNhighlightPixmap Manager XmNy Core
|
||||
.fi
|
||||
|
||||
.SS Folder Translations
|
||||
Folder defines the translations shown below.
|
||||
|
||||
.nf
|
||||
.ft B
|
||||
Event Action
|
||||
.ft P
|
||||
BSelect Press XmLFolderActivate()
|
||||
.fi
|
||||
.SS Folder Primitive Translations
|
||||
Folder overrides the translations shown below for all of
|
||||
its Primitive widget children.
|
||||
|
||||
.nf
|
||||
.ft B
|
||||
Event Action
|
||||
.ft P
|
||||
FocusIn PrimitiveFocusIn() XmLFolderPrimFocusIn()
|
||||
FocusOut PrimtiveFocusOut() XmLFolderPrimFocusOut()
|
||||
.fi
|
||||
.SS Action Routines
|
||||
Folder defines the actions shown below.
|
||||
.IP XmLFolderActivate()
|
||||
Activates the tab at the location of the event passed to the action routine.
|
||||
.IP XmLFolderPrimFocusIn()
|
||||
Draws a highlight around the given widget.
|
||||
.IP XmLFolderPrimFocusOut()
|
||||
Erases the highlight around the given widget.
|
||||
.SH "SEE ALSO"
|
||||
XmLCreateFolder(3X) XmLFolderAddBitmapTab(3X) XmLFolderAddBitmapTabForm(3X)
|
||||
XmLFolderAddTab(3X) XmLFolderAddTabForm(3X) XmLFolderSetActiveTab(3X)
|
||||
60
mozilla/cmd/xfe/Microline3.0/man/XmLFolderAddBitmapTab.3x
Normal file
60
mozilla/cmd/xfe/Microline3.0/man/XmLFolderAddBitmapTab.3x
Normal file
@@ -0,0 +1,60 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLFolderAddBitmapTab 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLFolderAddBitmapTab \- add a tab to a Folder containing a string and bitmap
|
||||
.SH SYNTAX
|
||||
Widget XmLFolderAddBitmapTab(\fIwidget\fP, \fIstring\fP, \
|
||||
\fIbitmapBits\fP, \fIbitmapWidth\fP, \fIbitmapHeight\fP)
|
||||
.br
|
||||
Widget \fIwidget\fP;
|
||||
.br
|
||||
XmString \fIstring\fP;
|
||||
.br
|
||||
char *\fIbitmapBits\fP;
|
||||
.br
|
||||
int \fIbitmapWidth\fP;
|
||||
.br
|
||||
int \fIbitmapHeight\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIwidget\fP 1i
|
||||
Folder widget ID
|
||||
.IP \fIstring\fP 1i
|
||||
string to display in the tab
|
||||
.IP \fIbitmapBits\fP 1i
|
||||
bitmap to display in the tab
|
||||
.IP \fIbitmapWidth\fP 1i
|
||||
width of the bitmap in pixels
|
||||
.IP \fIbitmapHeight\fP 1i
|
||||
height of the bitmap in pixels
|
||||
.SH DESCRIPTION
|
||||
Adds a tab to the Folder \fIwidget\fP containing the \fIstring\fP and
|
||||
\fIbitmap\fP specified.
|
||||
.SH RETURN VALUE
|
||||
Returns the widget ID of the DrawnButton widget contained in the tab.
|
||||
.SH "SEE ALSO"
|
||||
XmLFolderAddBitmapTabForm(3X) XmLFolderAddTab(3X) XmLFolder(3X)
|
||||
@@ -0,0 +1,62 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLFolderAddBitmapTabForm 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLFolderAddBitmapTabForm \- add a tab to a Folder containing a string
|
||||
and bitmap and a form managed by the tab
|
||||
.SH SYNTAX
|
||||
Widget XmLFolderAddBitmapTabForm(\fIwidget\fP, \fIstring\fP, \
|
||||
\fIbitmapBits\fP, \fIbitmapWidth\fP, \fIbitmapHeight\fP)
|
||||
.br
|
||||
Widget \fIwidget\fP;
|
||||
.br
|
||||
XmString \fIstring\fP;
|
||||
.br
|
||||
char *\fIbitmapBits\fP;
|
||||
.br
|
||||
int \fIbitmapWidth\fP;
|
||||
.br
|
||||
int \fIbitmapHeight\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIwidget\fP 1i
|
||||
Folder widget ID
|
||||
.IP \fIstring\fP 1i
|
||||
string to display in the tab
|
||||
.IP \fIbitmapBits\fP 1i
|
||||
bitmap to display in the tab
|
||||
.IP \fIbitmapWidth\fP 1i
|
||||
width of the bitmap in pixels
|
||||
.IP \fIbitmapHeight\fP 1i
|
||||
height of the bitmap in pixels
|
||||
.SH DESCRIPTION
|
||||
Adds a tab to the Folder \fIwidget\fP containing the \fIstring\fP and
|
||||
\fIbitmap\fP specified and adds a form (XmForm widget) to the Folder
|
||||
which is managed by that tab.
|
||||
.SH RETURN VALUE
|
||||
Returns the widget ID of the Form widget managed by the new tab.
|
||||
.SH "SEE ALSO"
|
||||
XmLFolderAddTab(3X) XmLFolder(3X)
|
||||
46
mozilla/cmd/xfe/Microline3.0/man/XmLFolderAddTab.3x
Normal file
46
mozilla/cmd/xfe/Microline3.0/man/XmLFolderAddTab.3x
Normal file
@@ -0,0 +1,46 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLFolderAddTab 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLFolderAddTab \- add a tab to a Folder containing a string
|
||||
.SH SYNTAX
|
||||
Widget XmLFolderAddTab(\fIwidget\fP, \fIstring\fP)
|
||||
.br
|
||||
Widget \fIwidget\fP;
|
||||
.br
|
||||
XmString \fIstring\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIwidget\fP 1i
|
||||
Folder widget ID
|
||||
.IP \fIstring\fP 1i
|
||||
string to display in the tab
|
||||
.SH DESCRIPTION
|
||||
Adds a tab to a Folder containing the \fIstring\fP specified.
|
||||
.SH RETURN VALUE
|
||||
Returns the widget ID of the DrawnButton widget contained in the tab.
|
||||
.SH "SEE ALSO"
|
||||
XmLFolderAddBitmapTab(3X) XmLFolder(3X)
|
||||
49
mozilla/cmd/xfe/Microline3.0/man/XmLFolderAddTabForm.3x
Normal file
49
mozilla/cmd/xfe/Microline3.0/man/XmLFolderAddTabForm.3x
Normal file
@@ -0,0 +1,49 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLFolderAddTabForm 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLFolderAddTabForm \- add a tab to a Folder containing a string and
|
||||
a form managed by the tab
|
||||
.SH SYNTAX
|
||||
Widget XmLFolderAddTabForm(\fIwidget\fP, \fIstring\fP)
|
||||
.br
|
||||
Widget \fIwidget\fP;
|
||||
.br
|
||||
XmString \fIstring\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIwidget\fP 1i
|
||||
Folder widget ID
|
||||
.IP \fIstring\fP 1i
|
||||
string to display in the tab
|
||||
.SH DESCRIPTION
|
||||
Adds a tab to the Folder \fIwidget\fP containing the \fIstring\fP
|
||||
specified and adds a form (XmForm widget) to the Folder which is
|
||||
managed by that tab.
|
||||
.SH RETURN VALUE
|
||||
Returns the widget ID of the Form widget managed by the new tab.
|
||||
.SH "SEE ALSO"
|
||||
XmLFolderAddBitmapTabForm(3X) XmLFolder(3X)
|
||||
52
mozilla/cmd/xfe/Microline3.0/man/XmLFolderSetActiveTab.3x
Normal file
52
mozilla/cmd/xfe/Microline3.0/man/XmLFolderSetActiveTab.3x
Normal file
@@ -0,0 +1,52 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLFolderSetActiveTab 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLFolderSetActiveTab \- activate a tab at a given position
|
||||
.SH SYNTAX
|
||||
void XmLFolderSetActiveTab(\fIwidget\fP, \fIposition\fP, \fInotify\fP)
|
||||
.br
|
||||
Widget \fIwidget\fP;
|
||||
.br
|
||||
int \fIposition\fP;
|
||||
.br
|
||||
Boolean \fInotify\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIwidget\fP 1i
|
||||
Folder widget ID
|
||||
.IP \fIposition\fP 1i
|
||||
active tab position
|
||||
.IP \fInotify\fP 1i
|
||||
if True, activate callback will be called
|
||||
.SH DESCRIPTION
|
||||
Activates a tab at the given \fIposition\fP. If the activated tab
|
||||
manages a widget, that widget will be managed and any other widgets
|
||||
managed by other tabs will be unmanaged. The Folder's XmNactivateCallback
|
||||
callbacks will be called if \fInotify\fP is True and the position passed
|
||||
is different from the current active position.
|
||||
.SH "SEE ALSO"
|
||||
XmLFolder(3X)
|
||||
42
mozilla/cmd/xfe/Microline3.0/man/XmLFontListCopyDefault.3x
Normal file
42
mozilla/cmd/xfe/Microline3.0/man/XmLFontListCopyDefault.3x
Normal file
@@ -0,0 +1,42 @@
|
||||
.\" 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.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.\" The following source code is part of the Microline Widget Library.
|
||||
.\" The Microline widget library is made available to Mozilla developers
|
||||
.\" under the Netscape Public License (NPL) by Neuron Data. To learn
|
||||
.\" more about Neuron Data, please visit the Neuron Data Home Page at
|
||||
.\" http://www.neurondata.com.
|
||||
.\"
|
||||
.\"
|
||||
.TH XmLFontListCopyDefault 3X "R1" "XML1" "XML"
|
||||
.SH NAME
|
||||
XmLFontListCopyDefault \- returns a copy of the default font list for a widget
|
||||
.SH SYNTAX
|
||||
XmLFontList XmLFontListCopyDefault(\fIwidget\fP)
|
||||
.br
|
||||
Widget \fIwidget\fP;
|
||||
.LP
|
||||
.SH ARGUMENTS
|
||||
.IP \fIwidget\fP 1i
|
||||
widget to retrieve default font list for
|
||||
.SH DESCRIPTION
|
||||
Returns a copy of the default font list for the given \fIwidget\fP.
|
||||
The default font list is found by looking for the font list default
|
||||
of the nearest BulletinBoard, MenuShell or VendorShell parent.
|
||||
.SH RETURN VALUE
|
||||
A copy of the default font list for the given \fIwidget\fP.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user