mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
added command line switches for setting window width and height
This commit is contained in:
parent
953b2efb58
commit
dba2c241d4
@ -210,6 +210,8 @@ PrintHelpInfo(char **argv)
|
||||
fprintf(stderr, "\t-r # -- set the repeat count, which is the number of times the URLs will be loaded in batch mode.\n");
|
||||
fprintf(stderr, "\t-f filename -- read a list of URLs from <filename>\n");
|
||||
fprintf(stderr, "\t-o dirname -- create an output file for the frame dump of each page and put it in <dirname>\n\t\t<dirname> must include the trailing <slash> character appropriate for your OS\n");
|
||||
fprintf(stderr, "\t-h # -- the initial height of the viewer window.");
|
||||
fprintf(stderr, "\t-w # -- the initial width of the viewer window.");
|
||||
fprintf(stderr, "\t-filter filtername -- make 'Dump Frames' command use the filter <filtername> to alter the output.\n\t\tfiltername = none, dump all frames\n\t\tfiltername = table, dump only table frames\n");
|
||||
fprintf(stderr, "\t-C -- enable crawler\n");
|
||||
fprintf(stderr, "\t-R filename -- record pages visited in <filename>\n");
|
||||
@ -337,6 +339,26 @@ nsViewerApp::ProcessArguments(int argc, char** argv)
|
||||
}
|
||||
mCrawler->SetDelay(delay);
|
||||
}
|
||||
else if (PL_strcmp(argv[i], "-w") == 0) {
|
||||
int width;
|
||||
i++;
|
||||
if (i>=argc || 1!=sscanf(argv[i], "%d", &width))
|
||||
{
|
||||
PrintHelpInfo(argv);
|
||||
exit(-1);
|
||||
}
|
||||
mCrawler->SetWidth(width);
|
||||
}
|
||||
else if (PL_strcmp(argv[i], "-h") == 0) {
|
||||
int height;
|
||||
i++;
|
||||
if (i>=argc || 1!=sscanf(argv[i], "%d", &height))
|
||||
{
|
||||
PrintHelpInfo(argv);
|
||||
exit(-1);
|
||||
}
|
||||
mCrawler->SetHeight(height);
|
||||
}
|
||||
else if (PL_strcmp(argv[i], "-r") == 0) {
|
||||
i++;
|
||||
if (i>=argc || 1!=sscanf(argv[i], "%d", &mRepeatCount))
|
||||
|
@ -152,6 +152,8 @@ nsWebCrawler::nsWebCrawler(nsViewerApp* aViewer)
|
||||
mOutputDir= nsnull;
|
||||
mPostExit = PR_FALSE;
|
||||
mDelay = 0;
|
||||
mWidth = -1;
|
||||
mHeight = -1;
|
||||
mMaxPages = -1;
|
||||
mRecord = nsnull;
|
||||
mLinkTag = NS_NewAtom("A");
|
||||
@ -569,6 +571,13 @@ nsWebCrawler::FindMoreURLs()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsWebCrawler::SetBrowserWindow(nsIBrowserWindow* aWindow)
|
||||
{
|
||||
mBrowser = aWindow;
|
||||
NS_ADDREF(mBrowser);
|
||||
}
|
||||
|
||||
static void
|
||||
TimerCallBack(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
@ -592,7 +601,16 @@ nsWebCrawler::LoadNextURL()
|
||||
if (nsnull != url) {
|
||||
if (OkToLoad(*url)) {
|
||||
RecordLoadedURL(*url);
|
||||
|
||||
if (0<=mWidth || 0<=mHeight)
|
||||
{
|
||||
nsRect r;
|
||||
mBrowser->GetBounds(r);
|
||||
if (0<=mWidth)
|
||||
r.width = mWidth;
|
||||
if (0<=mHeight)
|
||||
r.height = mHeight;
|
||||
mBrowser->SizeTo(r.width, r.height);
|
||||
}
|
||||
nsIWebShell* webShell;
|
||||
mBrowser->GetWebShell(webShell);
|
||||
webShell->LoadURL(*url);
|
||||
|
@ -54,16 +54,23 @@ public:
|
||||
// Add a domain that must be avoided
|
||||
void AddAvoidDomain(const nsString& aDomain);
|
||||
|
||||
void SetBrowserWindow(nsIBrowserWindow* aWindow) {
|
||||
mBrowser = aWindow;
|
||||
NS_ADDREF(mBrowser);
|
||||
}
|
||||
void SetBrowserWindow(nsIBrowserWindow* aWindow);
|
||||
|
||||
// Set the delay (by default, the timer is set to one second)
|
||||
void SetDelay(PRInt32 aSeconds) {
|
||||
mDelay = aSeconds;
|
||||
}
|
||||
|
||||
/** Set the initial window width */
|
||||
void SetWidth(PRInt32 aWidth) {
|
||||
mWidth = aWidth;
|
||||
}
|
||||
|
||||
/** Set the initial window width */
|
||||
void SetHeight(PRInt32 aHeight) {
|
||||
mHeight = aHeight;
|
||||
}
|
||||
|
||||
void EnableJiggleLayout() {
|
||||
mJiggleLayout = PR_TRUE;
|
||||
}
|
||||
@ -128,6 +135,8 @@ protected:
|
||||
PRBool mJiggleLayout;
|
||||
PRBool mPostExit;
|
||||
PRInt32 mDelay;
|
||||
PRInt32 mWidth;
|
||||
PRInt32 mHeight;
|
||||
PRInt32 mMaxPages;
|
||||
|
||||
nsVoidArray mPendingURLs;
|
||||
|
Loading…
Reference in New Issue
Block a user