fixup commit for tag 'KMELEON_0_4'

kmeleon10_branch KMELEON_0_4
cvs2hg 22 years ago
commit 273ac19098
  1. 87
      k-meleon/About.cpp
  2. 41
      k-meleon/About.h
  3. 310
      k-meleon/AccelParser.cpp
  4. 44
      k-meleon/AccelParser.h
  5. 417
      k-meleon/BrowserFrameGlue.cpp
  6. 596
      k-meleon/BrowserFrm.cpp
  7. 209
      k-meleon/BrowserFrm.h
  8. 401
      k-meleon/BrowserImpl.cpp
  9. 61
      k-meleon/BrowserImpl.h
  10. 150
      k-meleon/BrowserImplContentLstnr.cpp
  11. 39
      k-meleon/BrowserImplCtxMenuLstnr.cpp
  12. 123
      k-meleon/BrowserImplWebPrgrsLstnr.cpp
  13. 1421
      k-meleon/BrowserView.cpp
  14. 195
      k-meleon/BrowserView.h
  15. 110
      k-meleon/Dialogs.cpp
  16. 53
      k-meleon/Dialogs.h
  17. 97
      k-meleon/IBrowserFrameGlue.h
  18. 340
      k-meleon/Install/GNUlicense.txt
  19. 1
      k-meleon/Install/K-MeleonUNINST.ini
  20. 916
      k-meleon/Install/License.txt
  21. BIN
      k-meleon/Install/No.bmp
  22. BIN
      k-meleon/Install/Yes.bmp
  23. 176
      k-meleon/Install/k-meleon.nsi
  24. BIN
      k-meleon/Install/makensis.exe
  25. 118
      k-meleon/Install/readme.txt
  26. 436
      k-meleon/KMeleon.dsp
  27. 137
      k-meleon/KMeleon.dsw
  28. 44
      k-meleon/KMeleonConst.h
  29. 186
      k-meleon/Log.h
  30. 226
      k-meleon/MenuParser.cpp
  31. 39
      k-meleon/MenuParser.h
  32. 582
      k-meleon/MfcEmbed.cpp
  33. 128
      k-meleon/MfcEmbed.h
  34. 634
      k-meleon/MfcEmbed.rc
  35. 116
      k-meleon/MostRecentUrls.cpp
  36. 32
      k-meleon/MostRecentUrls.h
  37. 395
      k-meleon/Plugins.cpp
  38. 53
      k-meleon/Plugins.h
  39. 336
      k-meleon/Preferences.cpp
  40. 207
      k-meleon/Preferences.h
  41. 472
      k-meleon/PreferencesDlg.cpp
  42. 246
      k-meleon/PrintProgressDialog.cpp
  43. 70
      k-meleon/PrintProgressDialog.h
  44. 189
      k-meleon/ProfileMgr.cpp
  45. 55
      k-meleon/ProfileMgr.h
  46. 292
      k-meleon/ProfilesDlg.cpp
  47. 120
      k-meleon/ProfilesDlg.h
  48. 132
      k-meleon/README.TXT
  49. 202
      k-meleon/ReBarEx.cpp
  50. 48
      k-meleon/ReBarEx.h
  51. 31
      k-meleon/StdAfx.cpp
  52. 94
      k-meleon/StdAfx.h
  53. 182
      k-meleon/ToolBarEx.cpp
  54. 45
      k-meleon/ToolBarEx.h
  55. 102
      k-meleon/Utils.cpp
  56. 23
      k-meleon/Utils.h
  57. 8
      k-meleon/bmp_menu/StdAfx.cpp
  58. 29
      k-meleon/bmp_menu/StdAfx.h
  59. 600
      k-meleon/bmp_menu/bmp_menu.cpp
  60. 121
      k-meleon/bmp_menu/bmp_menu.dsp
  61. 242
      k-meleon/components/Dialogs.cpp
  62. 126
      k-meleon/components/Dialogs.h
  63. 136
      k-meleon/components/Dialogs.rc
  64. 389
      k-meleon/components/PromptService.cpp
  65. 44
      k-meleon/components/PromptService.h
  66. 150
      k-meleon/components/components.dsp
  67. 26
      k-meleon/components/resource.h
  68. 45
      k-meleon/components/stdafx.h
  69. BIN
      k-meleon/default/Back.bmp
  70. BIN
      k-meleon/default/Throbber.avi
  71. BIN
      k-meleon/default/Tool1.bmp
  72. BIN
      k-meleon/default/Tool2.bmp
  73. BIN
      k-meleon/default/Tool3.bmp
  74. 50
      k-meleon/default/accel.cfg
  75. 44
      k-meleon/default/macros.cfg
  76. 31
      k-meleon/default/menuicons.cfg
  77. 233
      k-meleon/default/menus.cfg
  78. 32
      k-meleon/default/prefs.js
  79. 48
      k-meleon/defineMap.cpp
  80. 241
      k-meleon/fullscreen/fullscreen.cpp
  81. 118
      k-meleon/fullscreen/fullscreen.dsp
  82. 32
      k-meleon/fullscreen/fullscreen.h
  83. 87
      k-meleon/fullscreen/fullscreen.rc
  84. 23
      k-meleon/fullscreen/resource.h
  85. 307
      k-meleon/history/history.cpp
  86. 132
      k-meleon/history/history.dsp
  87. 36
      k-meleon/history/history.h
  88. 8
      k-meleon/ie_favorites/StdAfx.cpp
  89. 27
      k-meleon/ie_favorites/StdAfx.h
  90. 566
      k-meleon/ie_favorites/ie_favorites.cpp
  91. 123
      k-meleon/ie_favorites/ie_favorites.dsp
  92. 96
      k-meleon/kmeleon_plugin.h
  93. 8
      k-meleon/kmeleon_winamp/StdAfx.cpp
  94. 25
      k-meleon/kmeleon_winamp/StdAfx.h
  95. BIN
      k-meleon/kmeleon_winamp/bmp00001.bmp
  96. 441
      k-meleon/kmeleon_winamp/frontend.h
  97. 216
      k-meleon/kmeleon_winamp/kmeleon_winamp.cpp
  98. 146
      k-meleon/kmeleon_winamp/kmeleon_winamp.dsp
  99. 161
      k-meleon/kmeleon_winamp/kmeleon_winamp.rc
  100. 2
      k-meleon/kmeleon_winamp/kmeleon_winamp.rc2
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,87 @@
/*
* Copyright (C) 2001 Jeff Doozan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "StdAfx.h"
#include "About.h"
#include "BrowserFrm.h"
#include "MfcEmbed.h"
extern CMfcEmbedApp theApp;
#define _QUOTE(blah) #blah
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
m_credits = _QUOTE(
\r\n
K-Meleon - Copyright 2000-2001\r\n
\r\n
Uses the Gecko rendering engine by the Mozilla Group\r\n
Based on MfcEmbed\r\n
Corner animation stolen from Galeon\r\n
\r\n
Current Contributors:\r\n
);
if (rand() % 2 == 1){
m_credits += _QUOTE(
Jeff Doozan <jeff@tcbnetworks.com>\r\n
Brian Harris <binaryc@teamreaction.com>\r\n
);
}else{
m_credits += _QUOTE(
Brian Harris <binaryc@teamreaction.com>\r\n
Jeff Doozan <jeff@tcbnetworks.com>\r\n
);
}
m_credits += _QUOTE(
Sebastian Spaeth <Sebastian@SSpaeth.de>\r\n
\r\n
Past Contributors:\r\n
Christophe Thibault <christophe@nullsoft.com>\r\n
Chak Nanga <chak@netscape.com>\r\n
\r\n
Documentation:\r\n
Lance Hall (aka pyzr) <pyzr@pyzr.com>
);
m_version.Format("Version " VERSION " Build %d Compiled " BUILD_TIME, BUILD_NUMBER);
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX){
DDX_Text(pDX, IDC_CREDITS, m_credits);
DDX_Text(pDX, IDC_VERSION, m_version);
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CMfcEmbedApp)
ON_COMMAND(IDC_KMELEON_HOME, OnHome)
ON_COMMAND(IDC_KMELEON_FORUM, OnForum)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CAboutDlg::OnHome() {
if (theApp.m_pMostRecentBrowserFrame)
theApp.m_pMostRecentBrowserFrame->PostMessage(WM_COMMAND, ID_LINK_KMELEON_HOME);
}
void CAboutDlg::OnForum() {
if (theApp.m_pMostRecentBrowserFrame)
theApp.m_pMostRecentBrowserFrame->PostMessage(WM_COMMAND, ID_LINK_KMELEON_FORUM);
}

@ -0,0 +1,41 @@
/*
* Copyright (C) 2001 Jeff Doozan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "version.h"
#include "resource.h"
#include "BrowserView.h"
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
enum { IDD = IDD_ABOUTBOX };
protected:
CString m_credits;
CString m_version;
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
protected:
//{{AFX_MSG(CMfcEmbedApp)
afx_msg void OnHome();
afx_msg void OnForum();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

@ -0,0 +1,310 @@
/*
* Copyright (C) 2000 Brian Harris
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "StdAfx.h"
#include <afxtempl.h>
#include "MfcEmbed.h"
extern CMfcEmbedApp theApp;
#include "AccelParser.h"
#include "Utils.h"
#include "resource.h"
#include "Plugins.h"
#include "kmeleon_plugin.h"
#define ENABLE_LOG
#include "Log.h"
#define BEGIN_VK_TEST if (0){}
#define VK_TEST(KEY) else if (stricmp(p, #KEY) == 0){ key = VK_##KEY; }
CAccelParser::CAccelParser(){
accelTable = NULL;
numAccelerators = 0;
memset(accelerators, 0, sizeof(ACCEL) * MAX_ACCEL);
}
CAccelParser::CAccelParser(CString &filename){
accelTable = NULL;
numAccelerators = 0;
memset(accelerators, 0, sizeof(ACCEL) * MAX_ACCEL);
Load(filename);
}
CAccelParser::~CAccelParser(){
if (accelTable){
DestroyAcceleratorTable(accelTable);
}
}
int CAccelParser::Load(CString &filename){
if (accelTable){
DestroyAcceleratorTable(accelTable);
accelTable = NULL;
numAccelerators = 0;
}
CFile *accelFile;
TRY {
accelFile = new CFile(filename, CFile::modeRead);
}
CATCH (CFileException, e) {
accelFile = NULL;
return 0;
}
END_CATCH
SETUP_LOG("Accel");
long length = accelFile->GetLength();
char *buffer = new char[length + 1];
accelFile->Read(buffer, length);
// force the terminating 0
buffer[length] = 0;
accelFile->Close();
delete accelFile;
accelFile = NULL;
CMap<CString, LPCSTR, int, int &> defineMap;
#include "defineMap.cpp"
int pauseParsing = 0;
char *e, *s;
char *alt, *ctrl, *shift;
BYTE virt;
int command;
int key;
char *p = strtok(buffer, "\r\n");
while (p){
if (p[0] == '#'){
}
else if (p[0] == '%'){
if (strnicmp(p+1, "strict", 6) == 0){
LOG_STRICT();
}
else if (strnicmp(p+1, "verbose", 7) == 0){
LOG_VERBOSE();
}
else if (strnicmp(p+1, "ifplugin", 8) == 0){
char *plugin = p+9;
kmeleonPlugin * kPlugin = theApp.plugins.Load(plugin);
if (!kPlugin || !kPlugin->loaded) {
pauseParsing = 1;
}
}
else if (strcmpi(p+1, "endif") == 0){
pauseParsing = 0;
}
}
else if (pauseParsing){
}
else {
// <modifiers> <key> = <command>
e = strchr(p, '=');
if (e){
*e = 0;
e++;
e = SkipWhiteSpace(e);
TrimWhiteSpace(e);
char *op = strchr(e, '(');
if (op) { // if there's an open parenthesis, we'll assume it's a plugin
char *parameter = op + 1;
char *cp = strrchr(parameter, ')');
if (cp) *cp = 0;
*op = 0;
TrimWhiteSpace(e);
kmeleonPlugin * kPlugin = theApp.plugins.Load(e);
if (!kPlugin || kPlugin->loaded) {
if (kPlugin->pf->DoAccel) {
command = kPlugin->pf->DoAccel(parameter);
LOG_2("Called plugin %s with parameter %s", e, parameter);
}
else
LOG_ERROR_2( "Plugin %s has no accelerator %s", e, parameter);
}
else
LOG_ERROR_2( "Could not load plugin %s\r\n\twith parameter %s", e, parameter );
}
else if (!defineMap.Lookup(e, command)) {
command = atoi(e);
}
TrimWhiteSpace(p);
s = p;
virt = 0;
alt = strstr(s, "ALT");
if (alt){
virt |= FALT;
p = alt + 3;
}
ctrl = strstr(s, "CTRL");
if (ctrl){
virt |= FCONTROL;
if (ctrl > alt){
p = ctrl + 4;
}
}
shift = strstr(s, "SHIFT");
if (shift){
virt |= FSHIFT;
if ((shift > alt) && (shift > ctrl)){
p = shift + 5;
}
}
virt |= FVIRTKEY;
// by now, p should be past the modifiers and point to " <key>"
p = SkipWhiteSpace(p);
if (strncmp(p, "VK_", 3) == 0){
p+=3;
key = 0;
// these should be in order of frequency of use to speed up parsing
BEGIN_VK_TEST
VK_TEST(ESCAPE)
VK_TEST(LEFT)
VK_TEST(RIGHT)
VK_TEST(F1)
VK_TEST(F2)
VK_TEST(F3)
VK_TEST(F4)
VK_TEST(F5)
VK_TEST(F6)
VK_TEST(F7)
VK_TEST(F8)
VK_TEST(F9)
VK_TEST(F10)
VK_TEST(F11)
VK_TEST(F12)
VK_TEST(HOME)
VK_TEST(END)
VK_TEST(PRIOR) // page up
VK_TEST(NEXT) // page down
VK_TEST(UP)
VK_TEST(DOWN)
VK_TEST(INSERT)
VK_TEST(DELETE)
VK_TEST(SPACE)
VK_TEST(HELP)
VK_TEST(EXECUTE)
VK_TEST(SELECT)
VK_TEST(PRINT)
VK_TEST(SNAPSHOT) // print screen?
VK_TEST(BACK)
VK_TEST(TAB)
VK_TEST(CLEAR)
VK_TEST(RETURN)
VK_TEST(MULTIPLY)
VK_TEST(ADD)
VK_TEST(SUBTRACT)
VK_TEST(DECIMAL)
VK_TEST(DIVIDE)
VK_TEST(SEPARATOR)
VK_TEST(PAUSE)
VK_TEST(CAPITAL)
VK_TEST(MENU)
VK_TEST(KANA)
VK_TEST(JUNJA)
VK_TEST(FINAL)
VK_TEST(HANJA)
VK_TEST(KANJI)
VK_TEST(CONVERT)
VK_TEST(NONCONVERT)
VK_TEST(ACCEPT)
VK_TEST(MODECHANGE)
VK_TEST(LWIN)
VK_TEST(RWIN)
VK_TEST(APPS)
VK_TEST(NUMPAD0)
VK_TEST(NUMPAD1)
VK_TEST(NUMPAD2)
VK_TEST(NUMPAD3)
VK_TEST(NUMPAD4)
VK_TEST(NUMPAD5)
VK_TEST(NUMPAD6)
VK_TEST(NUMPAD7)
VK_TEST(NUMPAD8)
VK_TEST(NUMPAD9)
VK_TEST(F13)
VK_TEST(F14)
VK_TEST(F15)
VK_TEST(F16)
VK_TEST(F17)
VK_TEST(F18)
VK_TEST(F19)
VK_TEST(F20)
VK_TEST(F21)
VK_TEST(F22)
VK_TEST(F23)
VK_TEST(F24)
VK_TEST(NUMLOCK)
VK_TEST(SCROLL)
}
else {
// regular key...
key = (WORD)*p;
}
accelerators[numAccelerators].cmd = command;
accelerators[numAccelerators].fVirt = virt;
accelerators[numAccelerators].key = key;
numAccelerators++;
} // if e
}
p = strtok(NULL, "\r\n");
} // while
delete [] buffer;
END_LOG();
return true;
}
HACCEL CAccelParser::GetTable(){
if (!accelTable){
accelTable = CreateAcceleratorTable(accelerators, numAccelerators);
}
return accelTable;
}

@ -0,0 +1,44 @@
/*
* Copyright (C) 2000 Brian Harris
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __ACCELPARSER_H__
#define __ACCELPARSER_H__
#include "StdAfx.h"
#define MAX_ACCEL 127
class CAccelParser {
protected:
ACCEL accelerators[MAX_ACCEL];
int numAccelerators;
HACCEL accelTable;
public:
CAccelParser();
CAccelParser(CString &filename);
~CAccelParser();
int Load(CString &filename);
HACCEL GetTable();
};
#endif // __ACCELPARSER_H__

@ -0,0 +1,417 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Chak Nanga <chak@netscape.com>
*/
// File Overview....
//
// This file has the IBrowserFrameGlueObj implementation
// This frame glue object is nested inside of the BrowserFrame
// object(See BrowserFrm.h for more info)
//
// This is the place where all the platform specific interaction
// with the browser frame window takes place in response to
// callbacks from Gecko interface methods
//
// The main purpose of this interface is to separate the cross
// platform code in BrowserImpl*.cpp from the platform specific
// code(which is in this file)
//
// You'll also notice the use of a macro named "METHOD_PROLOGUE"
// through out this file. This macro essentially makes the pointer
// to a "containing" class available inside of the class which is
// being contained via a var named "pThis". In our case, the
// BrowserFrameGlue object is contained inside of the BrowserFrame
// object so "pThis" will be a pointer to a BrowserFrame object
// Refer to MFC docs for more info on METHOD_PROLOGUE macro
#include "stdafx.h"
#include "MfcEmbed.h"
#include "BrowserFrm.h"
#include "Dialogs.h"
#include "MenuParser.h"
#include "KmeleonConst.h"
extern CMfcEmbedApp theApp;
/////////////////////////////////////////////////////////////////////////////
// IBrowserFrameGlue implementation
void CBrowserFrame::BrowserFrameGlueObj::UpdateStatusBarText(const PRUnichar *aMessage)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
nsCString strStatus;
if(aMessage)
strStatus.AssignWithConversion(aMessage);
pThis->m_wndStatusBar.SetPaneText(0, strStatus.get());
}
void CBrowserFrame::BrowserFrameGlueObj::UpdateProgress(PRInt32 aCurrent, PRInt32 aMax)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->m_wndProgressBar.SetRange32(0, aMax);
pThis->m_wndProgressBar.SetPos(aCurrent);
}
void CBrowserFrame::BrowserFrameGlueObj::UpdateBusyState(PRBool aBusy)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
// Just notify the view of the busy state
// There's code in there which will take care of
// updating the STOP toolbar btn. etc
pThis->m_wndBrowserView.UpdateBusyState(aBusy);
}
// Called from the OnLocationChange() method in the nsIWebProgressListener
// interface implementation in CBrowserImpl to update the current URI
// Will get called after a URI is successfully loaded in the browser
// We use this info to update the URL bar's edit box
//
void CBrowserFrame::BrowserFrameGlueObj::UpdateCurrentURI(nsIURI *aLocation){
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
if(aLocation) {
nsXPIDLCString uriString;
aLocation->GetSpec(getter_Copies(uriString));
pThis->m_wndUrlBar.SetCurrentURL(uriString.get());
}
if (pThis->IsChild(GetFocus())) {
// the context menus break if we don't do this ???
pThis->SetFocus();
// switch the focus to the URLBar, if necessary
if (pThis->m_setURLBarFocus) {
pThis->m_wndUrlBar.SetFocus();
pThis->m_setURLBarFocus = false;
}
}
}
void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameTitle(PRUnichar **aTitle)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
CString title;
pThis->GetWindowText(title);
if(!title.IsEmpty())
{
nsString nsTitle;
nsTitle.AssignWithConversion(title.GetBuffer(0));
*aTitle = nsTitle.ToNewUnicode();
}
}
void CBrowserFrame::BrowserFrameGlueObj::SetBrowserFrameTitle(const PRUnichar *aTitle)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
USES_CONVERSION;
CString cs;
cs.LoadString(AFX_IDS_APP_TITLE);
CString title = W2T(aTitle);
if (title.IsEmpty()){
pThis->m_wndUrlBar.GetEnteredURL(title);
}
title += " (" + cs + ')';
pThis->SetWindowText(title);
pThis->PostMessage(UWM_UPDATESESSIONHISTORY, 0, 0);
}
void CBrowserFrame::BrowserFrameGlueObj::SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->SetWindowPos(NULL, 0, 0, aCX, aCY,
SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER
);
}
void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameSize(PRInt32 *aCX, PRInt32 *aCY)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
RECT wndRect;
pThis->GetWindowRect(&wndRect);
if (aCX)
*aCX = wndRect.right - wndRect.left;
if (aCY)
*aCY = wndRect.bottom - wndRect.top;
}
void CBrowserFrame::BrowserFrameGlueObj::SetBrowserFramePosition(PRInt32 aX, PRInt32 aY)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->SetWindowPos(NULL, aX, aY, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFramePosition(PRInt32 *aX, PRInt32 *aY)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
RECT wndRect;
pThis->GetWindowRect(&wndRect);
if (aX)
*aX = wndRect.left;
if (aY)
*aY = wndRect.top;
}
void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFramePositionAndSize(PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
RECT wndRect;
pThis->GetWindowRect(&wndRect);
if (aX)
*aX = wndRect.left;
if (aY)
*aY = wndRect.top;
if (aCX)
*aCX = wndRect.right - wndRect.left;
if (aCY)
*aCY = wndRect.bottom - wndRect.top;
}
void CBrowserFrame::BrowserFrameGlueObj::SetBrowserFramePositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, PRBool fRepaint)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->SetWindowPos(NULL, aX, aY, aCX, aCY,
SWP_NOACTIVATE | SWP_NOZORDER);
}
void CBrowserFrame::BrowserFrameGlueObj::SetFocus()
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->SetFocus();
}
void CBrowserFrame::BrowserFrameGlueObj::FocusAvailable(PRBool *aFocusAvail)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
HWND focusWnd = GetFocus()->m_hWnd;
if ((focusWnd == pThis->m_hWnd) || ::IsChild(pThis->m_hWnd, focusWnd))
*aFocusAvail = PR_TRUE;
else
*aFocusAvail = PR_FALSE;
}
void CBrowserFrame::BrowserFrameGlueObj::ShowBrowserFrame(PRBool aShow)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
if(aShow)
{
pThis->ShowWindow(SW_SHOW);
pThis->SetActiveWindow();
pThis->UpdateWindow();
}
else
{
pThis->ShowWindow(SW_HIDE);
}
}
void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameVisibility(PRBool *aVisible)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
// Is the current BrowserFrame the active one?
if (GetActiveWindow()->m_hWnd != pThis->m_hWnd)
{
*aVisible = PR_FALSE;
return;
}
// We're the active one
//Return FALSE if we're minimized
WINDOWPLACEMENT wpl;
pThis->GetWindowPlacement(&wpl);
if ((wpl.showCmd == SW_RESTORE) || (wpl.showCmd == SW_MAXIMIZE))
*aVisible = PR_TRUE;
else
*aVisible = PR_FALSE;
}
PRBool CBrowserFrame::BrowserFrameGlueObj::CreateNewBrowserFrame(PRUint32 chromeMask,
PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
nsIWebBrowser** aWebBrowser)
{
NS_ENSURE_ARG_POINTER(aWebBrowser);
*aWebBrowser = nsnull;
CMfcEmbedApp *pApp = (CMfcEmbedApp *)AfxGetApp();
if(!pApp)
return PR_FALSE;
// Note that we're calling with the last param set to "false" i.e.
// this instructs not to show the frame window
// This is mainly needed when the window size is specified in the window.open()
// JS call. In those cases Gecko calls us to create the browser with a default
// size (all are -1) and then it calls the SizeBrowserTo() method to set
// the proper window size. If this window were to be visible then you'll see
// the window size changes on the screen causing an unappealing flicker
CBrowserFrame* pFrm = pApp->CreateNewBrowserFrame(chromeMask, x, y, cx, cy, PR_FALSE);
if(!pFrm)
return PR_FALSE;
// At this stage we have a new CBrowserFrame and a new CBrowserView
// objects. The CBrowserView also would have an embedded browser
// object created. Get the mWebBrowser member from the CBrowserView
// and return it. (See CBrowserView's CreateBrowser() on how the
// embedded browser gets created and how it's mWebBrowser member
// gets initialized)
NS_IF_ADDREF(*aWebBrowser = pFrm->m_wndBrowserView.mWebBrowser);
return PR_TRUE;
}
void CBrowserFrame::BrowserFrameGlueObj::DestroyBrowserFrame()
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
pThis->PostMessage(WM_CLOSE);
}
void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags, nsIDOMNode *aNode)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
char *menuType = _T("DocumentPopup");
if(aContextFlags & nsIContextMenuListener::CONTEXT_DOCUMENT)
menuType = _T("DocumentPopup");
else if((aContextFlags & nsIContextMenuListener::CONTEXT_TEXT) || (aContextFlags & nsIContextMenuListener::CONTEXT_INPUT))
menuType = _T("TextPopup");
else if(aContextFlags & nsIContextMenuListener::CONTEXT_LINK)
{
menuType = _T("LinkPopup");
// Since we handle all the browser menu/toolbar commands
// in the View, we basically setup the Link's URL in the
// BrowserView object. When a menu selection in the context
// menu is made, the appropriate command handler in the
// BrowserView will be invoked and the value of the URL
// will be accesible in the view
// Reset the value from the last invocation
// (A new value will be set after we determine it below)
//
nsAutoString strUrlUcs2;
pThis->m_wndBrowserView.SetCtxMenuLinkUrl(strUrlUcs2);
// Get the URL from the link. This is two step process
// 1. We first get the nsIDOMHTMLAnchorElement
// 2. We then get the URL associated with the link
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLAnchorElement> linkElement(do_QueryInterface(aNode, &rv));
if(NS_FAILED(rv)){
nsCOMPtr<nsIDOMNode> parentNode;
aNode->GetParentNode(getter_AddRefs(parentNode));
linkElement = do_QueryInterface(parentNode, &rv);
if (NS_FAILED(rv)){
return;
}
}
rv = linkElement->GetHref(strUrlUcs2);
if(NS_FAILED(rv))
return;
// Update the view with the new LinkUrl
// Note that this string is in UCS2 format
pThis->m_wndBrowserView.SetCtxMenuLinkUrl(strUrlUcs2);
}
if(aContextFlags & nsIContextMenuListener::CONTEXT_IMAGE) {
if(aContextFlags & nsIContextMenuListener::CONTEXT_LINK)
menuType = _T("ImageLinkPopup");
else
menuType = _T("ImagePopup");
nsAutoString strImgSrcUcs2;
pThis->m_wndBrowserView.SetCtxMenuImageSrc(strImgSrcUcs2); // Clear it
// Get the IMG SRC
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLImageElement> imgElement(do_QueryInterface(aNode, &rv));
if(NS_FAILED(rv))
return;
rv = imgElement->GetSrc(strImgSrcUcs2);
if(NS_FAILED(rv))
return;
pThis->m_wndBrowserView.SetCtxMenuImageSrc(strImgSrcUcs2); // Set the new Img Src
}
CMenu *ctxMenu = theApp.menus.GetMenu(menuType);
if(ctxMenu)
{
POINT cursorPos;
GetCursorPos(&cursorPos);
static int display = 0;
if (display){
ctxMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, cursorPos.x, cursorPos.y, pThis);
}
display =! display;
}
}
HWND CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameNativeWnd()
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
return pThis->m_hWnd;
}

@ -0,0 +1,596 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Chak Nanga <chak@netscape.com>
*/
// File Overview....
//
// The typical MFC View, toolbar, statusbar creation done
// in CBrowserFrame::OnCreate()
//
// Code to update the Status/Tool bars in response to the
// Web page loading progress(called from methods in CBrowserImpl)
//
// SetupFrameChrome() determines what, if any, UI elements this Frame
// will sport based on the current "chromeMask"
//
// Also take a look at OnClose() which gets used when you close a browser
// window. This needs to be overrided mainly to handle supporting multiple
// browser frame windows via the "New Browser Window" menu item
// Without this being overridden the MFC framework handles the OnClose and
// shutsdown the complete application when a frame window is closed.
// In our case, we want the app to shutdown when the File/Exit menu is chosen
//
// Another key functionality this object implements is the IBrowserFrameGlue
// interface - that's the interface the Gecko embedding interfaces call
// upong to update the status bar etc.
// (Take a look at IBrowserFrameGlue.h for the interface definition and
// the BrowserFrm.h to see how we implement this interface - as a nested
// class)
// We pass this Glue object pointer to the CBrowserView object via the
// SetBrowserFrameGlue() method. The CBrowserView passes this on to the
// embedding interface implementaion
//
// Please note the use of the macro METHOD_PROLOGUE in the implementation
// of the nested BrowserFrameGlue object. Essentially what this macro does
// is to get you access to the outer (or the object which is containing the
// nested object) object via the pThis pointer.
// Refer to the AFXDISP.H file in VC++ include dirs
//
// Next suggested file to look at : BrowserView.cpp
#include "stdafx.h"
#include "BrowserFrm.h"
#include "BrowserView.h"
#include "ToolBarEx.h"
#include "KmeleonConst.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBrowserFrame
IMPLEMENT_DYNAMIC(CBrowserFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CBrowserFrame, CFrameWnd)
//{{AFX_MSG_MAP(CBrowserFrame)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_SIZE()
ON_WM_CLOSE()
ON_WM_ACTIVATE()
ON_WM_SYSCOLORCHANGE()
ON_WM_COPYDATA()
ON_MESSAGE(UWM_REFRESHTOOLBARITEM, RefreshToolBarItem)
ON_MESSAGE(UWM_NEWWINDOW, OnNewWindow)
ON_COMMAND_RANGE(TOOLBAR_MENU_START_ID, TOOLBAR_MENU_END_ID, ToggleToolBar)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // For the Status line
ID_PROG_BAR // For the Progress Bar
};
/////////////////////////////////////////////////////////////////////////////
// CBrowserFrame construction/destruction
CBrowserFrame::CBrowserFrame(PRUint32 chromeMask)
{
// Save the chromeMask off. It'll be used
// later to determine whether this browser frame
// will have menubar, toolbar, statusbar etc.
m_chromeMask = chromeMask;
m_created = false;
m_setURLBarFocus = false;
theApp.m_pMostRecentBrowserFrame = this;
}
CBrowserFrame::~CBrowserFrame()
{
}
void CBrowserFrame::OnClose()
{
// if we don't do this, then our menu will be destroyed when the first window is.
// that's bad because our menu is shared between all windows
SetMenu(NULL);
// the browserframeglue will be deleted soon, so we set it to null so it won't try to access it after it's deleted.
m_wndBrowserView.SetBrowserFrameGlue(NULL);
m_wndReBar.SaveBandSizes();
if (theApp.m_pMostRecentBrowserFrame == this) {
CBrowserFrame* pFrame;
POSITION pos = theApp.m_FrameWndLst.Find(this);
theApp.m_FrameWndLst.GetPrev(pos);
if (pos) pFrame = (CBrowserFrame *) theApp.m_FrameWndLst.GetPrev(pos); // previous frame
else pFrame = (CBrowserFrame *) theApp.m_FrameWndLst.GetTail(); // last frame
if (pFrame != this) theApp.m_pMostRecentBrowserFrame = pFrame;
else theApp.m_pMostRecentBrowserFrame = NULL;
// if no other browser views exist, nullify the pointer
}
theApp.RemoveFrameFromList(this);
ShowWindow(SW_HIDE);
DestroyWindow();
}
// This is where the UrlBar, ToolBar, StatusBar, ProgressBar
// get created
//
int CBrowserFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// tell all our plugins that we were created
theApp.plugins.OnCreate(this->m_hWnd);
// Pass "this" to the View for later callbacks
// and/or access to any public data members, if needed
//
m_wndBrowserView.SetBrowserFrame(this);
// Pass on the BrowserFrameGlue also to the View which
// it will use during the Init() process after creation
// of the BrowserImpl obj. Essentially, the View object
// hooks up the Embedded browser's callbacks to the BrowserFrame
// via this BrowserFrameGlue object
m_wndBrowserView.SetBrowserFrameGlue((PBROWSERFRAMEGLUE)&m_xBrowserFrameGlueObj);
// create a view to occupy the client area of the frame
// This will be the view in which the embedded browser will
// be displayed in
//
if (!m_wndBrowserView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
// create the URL bar (essentially a ComboBoxEx object)
if (!m_wndUrlBar.Create(CBS_DROPDOWN | WS_CHILD, CRect(0, 0, 200, 150), this, ID_URL_BAR))
{
TRACE0("Failed to create URL Bar\n");
return -1; // fail to create
}
// Load the Most Recently Used(MRU) Urls into the UrlBar
m_wndUrlBar.LoadMRUList();
// Create the toolbar with Back, Fwd, Stop, etc. buttons..
if (!m_wndToolBar.CreateEx (this, 0x40 | /*CCS_NOPARENTALIGN | CCS_NORESIZE | */ TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_AUTOSIZE | TBSTYLE_TOOLTIPS) )
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// back, forward, stop, reload, home, search
UINT buttons[6] = {
ID_NAV_BACK,
ID_NAV_FORWARD,
ID_NAV_STOP,
ID_NAV_RELOAD,
ID_NAV_HOME,
ID_NAV_SEARCH
};
HBITMAP bitmap;
m_toolbarColdImageList.Create(16, 16, ILC_MASK, 16, 32);
bitmap = (HBITMAP)LoadImage(NULL, theApp.preferences.settingsDir + "Tool1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
ImageList_AddMasked(m_toolbarColdImageList.m_hImageList, bitmap, RGB(192, 192, 192));
DeleteObject(bitmap);
m_wndToolBar.GetToolBarCtrl().SetImageList(&m_toolbarColdImageList);
m_toolbarHotImageList.Create(16, 16, ILC_MASK, 16, 32);
bitmap = (HBITMAP)LoadImage(NULL, theApp.preferences.settingsDir + "Tool2.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
ImageList_AddMasked(m_toolbarHotImageList.m_hImageList, bitmap, RGB(192, 192, 192));
DeleteObject(bitmap);
m_wndToolBar.GetToolBarCtrl().SetHotImageList(&m_toolbarHotImageList);
m_wndToolBar.SetButtons(buttons, 6);
m_wndUrlBar.SetImageList(&m_toolbarHotImageList);
// Create the animation control..
if (!m_wndAnimate.Create(WS_CHILD | WS_VISIBLE, CRect(0, 0, 10, 10), this, AFX_IDW_TOOLBAR + 2))
{
TRACE0("Failed to create animation\n");
return -1; // fail to create
}
if (!m_wndAnimate.Open(theApp.preferences.settingsDir + "Throbber.avi")){
m_wndAnimate.Open("Throbber.avi");
}
// Create a ReBar window to which the toolbar and UrlBar
// will be added
if (!m_wndReBar.Create(this))
{
TRACE0("Failed to create ReBar\n");
return -1; // fail to create
}
//Add the ToolBar and UrlBar windows to the rebar
m_wndReBar.AddBar(&m_wndToolBar, NULL);
m_wndReBar.AddBar(&m_wndUrlBar, "URL:");
m_wndReBar.AddBar(&m_wndAnimate, NULL, NULL, RBBS_FIXEDSIZE | RBBS_FIXEDBMP);
m_wndReBar.RegisterBand(m_wndToolBar.m_hWnd, "Tool Bar");
m_wndReBar.RegisterBand(m_wndUrlBar.m_hWnd, "URL Bar");
// m_wndReBar.RegisterBand(m_wndAnimate.m_hWnd, "Throbber");
//--------------------------------------------------------------
// Set up min/max sizes and ideal sizes for pieces of the rebar:
//--------------------------------------------------------------
CReBarCtrl *rebarControl = &m_wndReBar.GetReBarCtrl();
// Address Bar
CRect rectAddress;
m_wndUrlBar.GetEditCtrl()->GetWindowRect(&rectAddress);
REBARBANDINFO rbbi;
rbbi.cbSize = sizeof(rbbi);
rbbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_SIZE;
rbbi.cxMinChild = 0;
rbbi.cyMinChild = rectAddress.Height() + 7;
rbbi.cxIdeal = 200;
rbbi.cx = 200;
rebarControl->SetBandInfo (1, &rbbi);
// Toolbar
CRect rectToolBar;
m_wndToolBar.GetItemRect(0, &rectToolBar);
rbbi.cbSize = sizeof(rbbi);
rbbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_SIZE;
rbbi.cxMinChild = 0;
rbbi.cyMinChild = rectToolBar.Height();
rbbi.cxIdeal = rectToolBar.Width() * m_wndToolBar.GetCount();
rbbi.cx = rbbi.cxIdeal + 10;
rebarControl->SetBandInfo (0, &rbbi);
theApp.plugins.DoRebars(m_wndReBar.GetReBarCtrl().m_hWnd);
m_wndReBar.RestoreBandSizes();
LoadBackImage();
SetBackImage();
// Create the status bar with two panes - one pane for actual status
// text msgs. and the other for the progress control
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetPaneStyle(m_wndStatusBar.CommandToIndex(ID_SEPARATOR), SBPS_STRETCH);
// Create the progress bar as a child of the status bar.
// Note that the ItemRect which we'll get at this stage
// is bogus since the status bar panes are not fully
// positioned yet i.e. we'll be passing in an invalid rect
// to the Create function below
// The actual positioning of the progress bar will be done
// in response to OnSize()
RECT rc;
m_wndStatusBar.GetItemRect (m_wndStatusBar.CommandToIndex(ID_PROG_BAR), &rc);
if (!m_wndProgressBar.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH, rc, &m_wndStatusBar, ID_PROG_BAR))
{
TRACE0("Failed to create progress bar\n");
return -1; // fail to create
}
// Based on the "chromeMask" we were supplied during construction
// hide any requested UI elements - statusbar, menubar etc...
// Note that the window styles (WM_RESIZE etc) are set inside
// of PreCreateWindow()
SetupFrameChrome();
return 0;
}
void CBrowserFrame::SetupFrameChrome()
{
if(m_chromeMask == nsIWebBrowserChrome::CHROME_ALL){
return;
}
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_MENUBAR) )
SetMenu(NULL); // Hide the MenuBar
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_TOOLBAR) )
m_wndReBar.ShowWindow(SW_HIDE); // Hide the ToolBar
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_STATUSBAR) )
m_wndStatusBar.ShowWindow(SW_HIDE); // Hide the StatusBar
}
BOOL CBrowserFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
// Change window style based on the chromeMask
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_TITLEBAR) )
cs.style &= ~WS_CAPTION; // No caption
if(! (m_chromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
{
// Can't resize this window
cs.style &= ~WS_SIZEBOX;
cs.style &= ~WS_THICKFRAME;
cs.style &= ~WS_MINIMIZEBOX;
cs.style &= ~WS_MAXIMIZEBOX;
}
cs.lpszClass = theApp.GetMainWindowClassName();
// cs.lpszClass = AfxRegisterWndClass(0);
// this function is actually called twice per window.
// the first time hInstance is 0
if (cs.hInstance){
CMenu *menu = theApp.menus.GetMenu(_T("Main"));
if (menu){
cs.hMenu = menu->m_hMenu;
}
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CBrowserFrame message handlers
void CBrowserFrame::OnSetFocus(CWnd* pOldWnd)
{
// forward focus to the browser window
m_wndBrowserView.SetFocus();
if (theApp.m_pMostRecentBrowserFrame != this) {
theApp.m_pMostRecentBrowserFrame = this;
// update session history for the current window
PostMessage(UWM_UPDATESESSIONHISTORY, 0, 0);
}
}
void CBrowserFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) {
CFrameWnd::OnActivate(nState, pWndOther, bMinimized);
m_wndBrowserView.Activate(nState, pWndOther, bMinimized);
}
BOOL CBrowserFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
if (nCode == CN_COMMAND){
if (pHandlerInfo && theApp.plugins.OnUpdate(nID)){
return true;
}
}
// let the view have first crack at the command
if (m_wndBrowserView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
// otherwise, do default handling
return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
// Needed to properly position/resize the progress bar
//
void CBrowserFrame::OnSize(UINT nType, int cx, int cy) {
CFrameWnd::OnSize(nType, cx, cy);
// Get the ItemRect of the status bar's Pane 0
// That's where the progress bar will be located
RECT rc;
if (m_wndStatusBar.m_hWnd)
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_PROG_BAR), &rc);
// Move the progress bar into it's correct location
//
if (m_wndProgressBar.m_hWnd)
m_wndProgressBar.MoveWindow(&rc);
if (!m_created) return;
// record the maximized state
if (nType == SIZE_MAXIMIZED)
theApp.preferences.bMaximized = true;
// record the window size/pos
else if (nType == SIZE_RESTORED) {
theApp.preferences.bMaximized = false;
GetWindowRect(&rc);
theApp.preferences.width = rc.right - rc.left;
theApp.preferences.height = rc.bottom - rc.top;
}
}
/////////////////////////////////////////////////////////////////////////////
void CBrowserFrame::OnSysColorChange()
{
CFrameWnd::OnSysColorChange();
//-------------------------
// Reload background image:
//-------------------------
LoadBackImage ();
SetBackImage ();
}
/////////////////////////////////////////////////////////////////////////////
void CBrowserFrame::SetBackImage ()
{
CReBarCtrl& rc = m_wndReBar.GetReBarCtrl ();
for (UINT i = 0; i < rc.GetBandCount(); i++) {
REBARBANDINFO info;
memset (&info, 0, sizeof (REBARBANDINFO));
info.cbSize = sizeof (info);
info.fMask = RBBIM_BACKGROUND;
info.hbmBack = theApp.preferences.bToolbarBackground ? (HBITMAP)m_bmpBack : NULL;
rc.SetBandInfo (i, &info);
CRect rectBand;
rc.GetRect (i, rectBand);
rc.InvalidateRect (rectBand);
rc.UpdateWindow ();
info.fMask = RBBIM_CHILD;
rc.GetBandInfo (i, &info);
if (info.hwndChild != NULL)
{
::InvalidateRect (