Support -w and -h arguments (finally!)

git-svn-id: svn://10.0.0.236/trunk@26152 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kipp%netscape.com
1999-04-03 18:46:22 +00:00
parent 0ef295ae5e
commit 66d4985883
4 changed files with 9 additions and 27 deletions

View File

@@ -100,6 +100,8 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID);
#define DEFAULT_WIDTH 620
#define DEFAULT_HEIGHT 400
nsViewerApp::nsViewerApp()
@@ -117,6 +119,8 @@ nsViewerApp::nsViewerApp()
mNumSamples = 14;
mAllowPlugins = PR_TRUE;
mIsInitialized = PR_FALSE;
mWidth = DEFAULT_WIDTH;
mHeight = DEFAULT_HEIGHT;
}
nsViewerApp::~nsViewerApp()
@@ -490,7 +494,7 @@ nsViewerApp::ProcessArguments(int argc, char** argv)
PrintHelpInfo(argv);
exit(-1);
}
mCrawler->SetWidth(width);
mWidth = width > 0 ? width : DEFAULT_WIDTH;
}
else if (PL_strcmp(argv[i], "-h") == 0) {
int height;
@@ -500,7 +504,7 @@ nsViewerApp::ProcessArguments(int argc, char** argv)
PrintHelpInfo(argv);
exit(-1);
}
mCrawler->SetHeight(height);
mHeight = height > 0 ? height : DEFAULT_HEIGHT;
}
else if (PL_strcmp(argv[i], "-r") == 0) {
i++;
@@ -593,7 +597,8 @@ nsViewerApp::OpenWindow()
return rv;
}
bw->SetApp(this);
bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0), mAllowPlugins);
bw->Init(mAppShell, mPrefs, nsRect(0, 0, mWidth, mHeight),
PRUint32(~0), mAllowPlugins);
bw->Show();
nsIBrowserWindow* bwCurrent;
mCrawler->GetBrowserWindow(&bwCurrent);

View File

@@ -86,6 +86,7 @@ protected:
nsWebCrawler* mCrawler;
PRBool mAllowPlugins;
PRBool mIsInitialized;
PRInt32 mWidth, mHeight;
};
class nsNativeViewerApp : public nsViewerApp {

View File

@@ -158,8 +158,6 @@ nsWebCrawler::nsWebCrawler(nsViewerApp* aViewer)
mJiggleLayout = PR_FALSE;
mPostExit = PR_FALSE;
mDelay = 0;
mWidth = -1;
mHeight = -1;
mMaxPages = -1;
mRecord = nsnull;
mLinkTag = NS_NewAtom("a");
@@ -698,16 +696,6 @@ 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);
mCurrentURL = *url;

View File

@@ -65,16 +65,6 @@ public:
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;
}
@@ -151,8 +141,6 @@ protected:
PRBool mJiggleLayout;
PRBool mPostExit;
PRInt32 mDelay;
PRInt32 mWidth;
PRInt32 mHeight;
PRInt32 mMaxPages;
nsString mCurrentURL;