Initial Checkin of new kmeleon

import/tags/kmeleon03
binaryc 22 years ago
parent 61a02eb63e
commit ff2c1f9ea6
  1. 235
      k-meleon/MenuParser.cpp
  2. 41
      k-meleon/MenuParser.h
  3. 479
      k-meleon/MfcEmbed.cpp
  4. 112
      k-meleon/MfcEmbed.h
  5. 585
      k-meleon/MfcEmbed.rc
  6. 166
      k-meleon/Plugins.cpp
  7. 50
      k-meleon/Plugins.h
  8. 295
      k-meleon/Preferences.cpp
  9. 121
      k-meleon/Preferences.h
  10. 189
      k-meleon/ProfileMgr.cpp
  11. 55
      k-meleon/ProfileMgr.h
  12. 292
      k-meleon/ProfilesDlg.cpp
  13. 120
      k-meleon/ProfilesDlg.h
  14. 132
      k-meleon/README.TXT
  15. 31
      k-meleon/StdAfx.cpp
  16. 87
      k-meleon/StdAfx.h
  17. 55
      k-meleon/kmeleon_plugin.h
  18. 96
      k-meleon/resource.h
  19. 307
      k-meleon/winEmbedFileLocProvider.cpp
  20. 53
      k-meleon/winEmbedFileLocProvider.h

@ -0,0 +1,235 @@
/*
* 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 "Plugins.h"
#include "MenuParser.h"
CMenuParser::CMenuParser(){
}
CMenuParser::CMenuParser(CString &filename){
Load(filename);
}
CMenuParser::~CMenuParser(){
POSITION pos = menus.GetStartPosition();
CMenu *m;
CString s;
while (pos){
menus.GetNextAssoc( pos, s, m);
if (m){
m->DestroyMenu();
}
}
}
void TranslateTabs(char *buffer){
char *p;
for (p=buffer; *p; p++){
if (*p == '\\'){
if (*(p+1) == 't'){
*p = ' ';
*(p+1) = '\t';
}
}
}
}
#define ERROR_BOX_1(msg, var1) \
{ char err[255]; \
sprintf(err, msg, var1); \
MessageBox(NULL, err, "Error", 0); \
}
#define ERROR_BOX_2(msg, var1, var2) \
{ char err[255]; \
sprintf(err, msg, var1, var2); \
MessageBox(NULL, err, "Error", 0); \
}
#define DEFINEMAP_ADD(entry) defineMap[#entry] = entry;
int CMenuParser::Load(CString &filename){
TRY {
menuFile = new CFile(filename, CFile::modeRead);
}
CATCH (CFileException, e) {
menuFile = NULL;
return 0;
}
END_CATCH
long length = menuFile->GetLength();
char *buffer = new char[length + 1];
menuFile->Read(buffer, length);
// force the terminating 0
buffer[length] = 0;
menuFile->Close();
delete menuFile;
menuFile = NULL;
TranslateTabs(buffer);
CMap<CString, LPCSTR, int, int &> defineMap;
DEFINEMAP_ADD(ID_NAV_BACK)
DEFINEMAP_ADD(ID_NAV_FORWARD)
DEFINEMAP_ADD(ID_NAV_HOME)
DEFINEMAP_ADD(ID_NAV_STOP)
DEFINEMAP_ADD(ID_NAV_RELOAD)
DEFINEMAP_ADD(ID_NAV_SEARCH)
DEFINEMAP_ADD(ID_VIEW_SOURCE)
DEFINEMAP_ADD(ID_VIEW_TOOLBAR)
DEFINEMAP_ADD(ID_VIEW_STATUS_BAR)
DEFINEMAP_ADD(ID_PREFERENCES)
DEFINEMAP_ADD(ID_NEW_BROWSER)
DEFINEMAP_ADD(ID_FILE_SAVE_AS)
DEFINEMAP_ADD(ID_FILE_OPEN)
DEFINEMAP_ADD(ID_FILE_CLOSE)
DEFINEMAP_ADD(ID_EDIT_CUT)
DEFINEMAP_ADD(ID_EDIT_COPY)
DEFINEMAP_ADD(ID_EDIT_PASTE)
DEFINEMAP_ADD(ID_APP_EXIT)
DEFINEMAP_ADD(ID_APP_ABOUT)
DEFINEMAP_ADD(ID_OPEN_LINK_IN_NEW_WINDOW)
DEFINEMAP_ADD(ID_COPY_LINK_LOCATION)
DEFINEMAP_ADD(ID_MANAGE_PROFILES)
//CMap<CString, LPCSTR, CMenu *, CMenu *&> menuMap;
char *currentMenuName = NULL;
CMenu *currentMenu = NULL;
char *p = strtok(buffer, "\r\n");
while (p){
if (*p == '#'){
}
else if (strnicmp(p, _T("MenuDef"), 7) == 0){
p+=8;
currentMenuName = NULL;
currentMenu = new CMenu();
if (strstr(p, _T("Popup"))){
currentMenu->CreatePopupMenu();
}else{
currentMenu->CreateMenu();
}
menus[p] = currentMenu;
}
else if (strnicmp(p, _T(":EndMenu"), 8) == 0){
}
else if (strnicmp(p, _T("Popup "), 6) == 0){
if (currentMenuName || currentMenu){
MessageBox(NULL, "Found Popup before :EndPopup", "", 0);
}
else{
p += 6; // jump past "Popup "
currentMenuName = p;
currentMenu = new CMenu();
currentMenu->CreatePopupMenu();
menus[p] = currentMenu;
}
}
else if (strnicmp(p, _T(":EndPopup"), 9) == 0){
//menuMap[CString(currentMenuName)] = currentMenu;
currentMenu = NULL;
currentMenuName = NULL;
}
else if (strnicmp(p, _T(":Popup "), 6) == 0){
p += 7;
CMenu *popup = NULL;
menus.Lookup(CString(p), popup);
if (popup){
currentMenu->AppendMenu(MF_POPUP | MF_STRING, (UINT)popup->m_hMenu, p);
}
}
else if (strnicmp(p, _T(":Seperator"), 10) == 0){
currentMenu->AppendMenu(MF_SEPARATOR);
}
else if (strnicmp(p, _T(":Plugin "), 8) == 0){
p+=8;
char *e = strrchr(p, '=');
if (e){
*e = 0;
e++;
kmeleonPlugin * kPlugin = theApp.plugins.Load(e);
if (kPlugin) {
if (kPlugin->DoMenu){
kPlugin->DoMenu(currentMenu->GetSafeHmenu(), p);
}else{
ERROR_BOX_1( "plugin %s has no menu", e);
}
}else{
ERROR_BOX_1( "Could not load plugin %s", e )
}
}
}
else if (*p == ':'){
// unknown command
}
else {
if (!currentMenu){
MessageBox(NULL, "Found Menu item with no menu!", "", 0);
}
else {
char *e = strrchr(p, '=');
if (e){
*e = 0;
e++;
int val;
if (!defineMap.Lookup(e, val)){
val = atoi(e);
}
currentMenu->AppendMenu(MF_STRING, val, p);
}
}
}
p = strtok(NULL, "\r\n");
};
/*
POSITION pos = menuMap.GetStartPosition();
CMenu *m;
CString s;
while (pos){
menuMap.GetNextAssoc( pos, s, m);
if (m){
m->Detach();
m->DestroyMenu();
}
}
*/
delete [] buffer;
return 1;
}
CMenu *CMenuParser::GetMenu(char *menuName){
CMenu *menu;
if (!menus.Lookup(menuName, menu)){
return NULL;
}
return menu;
}

@ -0,0 +1,41 @@
/*
* 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 __MENUPARSER_H__
#define __MENUPARSER_H__
#include "StdAfx.h"
class CMenuParser {
protected:
CFile *menuFile;
CMap<CString, LPCSTR, CMenu *, CMenu *&> menus;
public:
CMenuParser();
CMenuParser(CString &filename);
~CMenuParser();
Load(CString &filename);
CMenu *GetMenu(char * menuName);
};
#endif // __MENUPARSER_H__

@ -0,0 +1,479 @@
/* -*- 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>
* Conrad Carlen <ccarlen@netscape.com>
*/
// File Overview....
//
// The typical MFC app, frame creation code + AboutDlg handling
//
// NS_InitEmbedding() is called in InitInstance()
//
// NS_TermEmbedding() is called in ExitInstance()
// ExitInstance() also takes care of cleaning up of
// multiple browser frame windows on app exit
//
// NS_DoIdleEmbeddingStuff(); is called in the overridden
// OnIdle() method
//
// Code to handle the creation of a new browser window
// Next suggested file to look at : BrowserFrm.cpp
// Local Includes
#include "stdafx.h"
#include "MfcEmbed.h"
#include "BrowserFrm.h"
#include "winEmbedFileLocProvider.h"
#include "ProfileMgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(CMfcEmbedApp, CWinApp)
//{{AFX_MSG_MAP(CMfcEmbedApp)
ON_COMMAND(ID_NEW_BROWSER, OnNewBrowser)
ON_COMMAND(ID_MANAGE_PROFILES, OnManageProfiles)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_PREFERENCES, OnPreferences)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CMfcEmbedApp::CMfcEmbedApp() :
m_ProfileMgr(NULL)
{
mRefCnt = 1; // Start at one - nothing is going to addref this object
}
CMfcEmbedApp theApp;
// Initialize our MFC application and also init
// the Gecko embedding APIs
// Note that we're also init'ng the profile switching
// code here
// Then, create a new BrowserFrame and load our
// default homepage
//
BOOL CMfcEmbedApp::InitInstance()
{
Enable3dControls();
// Take a look at
// http://www.mozilla.org/projects/xpcom/file_locations.html
// for more info on File Locations
winEmbedFileLocProvider *provider = new winEmbedFileLocProvider("MfcEmbed");
if(!provider)
{
ASSERT(FALSE);
return FALSE;
}
nsresult rv;
rv = NS_InitEmbedding(nsnull, provider);
if(NS_FAILED(rv))
{
ASSERT(FALSE);
return FALSE;
}
if(!InitializeProfiles())
{
ASSERT(FALSE);
NS_TermEmbedding();
return FALSE;
}
InitializePrefs();
SetRegistryKey(_T("K-Meleon"));
// TODO: rather than having 2 seperate preferences thing (one for windows, one for mozilla)
// we should merge them into 1. that means changing the windows registry stuff to use
// nsIPrefs
preferences.Load();
plugins.FindAndLoad("kmeleon_*.dll");
if (!menus.Load(preferences.settingsDir + "menus.txt")){
MessageBox(NULL, "Ack! Could not find Menus.txt!", NULL, 0);
}
if(!CreateHiddenWindow())
{
ASSERT(FALSE);
NS_TermEmbedding();
return FALSE;
}
// Create the first browser frame window
OnNewBrowser();
return TRUE;
}
CBrowserFrame* CMfcEmbedApp::CreateNewBrowserFrame(PRUint32 chromeMask,
PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
PRBool bShowWindow)
{
// Setup a CRect with the requested window dimensions
CRect winSize(x, y, cx, cy);
LONG style = WS_OVERLAPPEDWINDOW;
// Use the Windows default if all are specified as -1
if(x == -1 && y == -1 && cx == -1 && cy == -1){
winSize = CFrameWnd::rectDefault;
style |= WS_MAXIMIZE;
}
// Load the window title from the string resource table
CString strTitle;
strTitle.LoadString(IDR_MAINFRAME);
// Now, create the browser frame
CBrowserFrame* pFrame = new CBrowserFrame(chromeMask);
if (!pFrame->Create(NULL, strTitle, style,
winSize, NULL, MAKEINTRESOURCE(IDR_MAINFRAME), 0L, NULL))
{
return NULL;
}
pFrame->SetIcon(LoadIcon(IDR_MAINFRAME), true);
pFrame->SetIcon(LoadIcon(IDR_MAINFRAME), false);
// load accelerator resource
pFrame->LoadAccelTable(MAKEINTRESOURCE(IDR_MAINFRAME));
// Show the window...
if(bShowWindow)
{
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
}
// Add to the list of BrowserFrame windows
m_FrameWndLst.AddHead(pFrame);
return pFrame;
}
void CMfcEmbedApp::OnNewBrowser()
{
CBrowserFrame *pBrowserFrame = CreateNewBrowserFrame();
//Load the HomePage into the browser view
if(pBrowserFrame)
pBrowserFrame->m_wndBrowserView.LoadHomePage();
}
// This gets called anytime a BrowserFrameWindow is
// closed i.e. by choosing the "close" menu item from
// a window's system menu or by dbl clicking on the
// system menu box
//
// Sends a WM_QUIT to the hidden window which results
// in ExitInstance() being called and the app is
// properly cleaned up and shutdown
//
void CMfcEmbedApp::RemoveFrameFromList(CBrowserFrame* pFrm, BOOL bCloseAppOnLastFrame/*= TRUE*/)
{
POSITION pos = m_FrameWndLst.Find(pFrm);
m_FrameWndLst.RemoveAt(pos);
// Send a WM_QUIT msg. to the hidden window if we've
// just closed the last browserframe window and
// if the bCloseAppOnLastFrame is TRUE. This be FALSE
// only in the case we're switching profiles
// Without this the hidden window will stick around
// i.e. the app will never die even after all the
// visible windows are gone.
if(m_FrameWndLst.GetCount() == 0 && bCloseAppOnLastFrame)
m_pMainWnd->PostMessage(WM_QUIT);
}
int CMfcEmbedApp::ExitInstance()
{
// When File/Exit is chosen and if the user
// has opened multiple browser windows shut all
// of them down properly before exiting the app
CBrowserFrame* pBrowserFrame = NULL;
POSITION pos = m_FrameWndLst.GetHeadPosition();
while( pos != NULL )
{
pBrowserFrame = (CBrowserFrame *) m_FrameWndLst.GetNext(pos);
if(pBrowserFrame)
{
pBrowserFrame->ShowWindow(false);
pBrowserFrame->DestroyWindow();
}
}
m_FrameWndLst.RemoveAll();
if (m_pMainWnd)
m_pMainWnd->DestroyWindow();
delete m_ProfileMgr;
NS_TermEmbedding();
return 1;
}
BOOL CMfcEmbedApp::OnIdle(LONG lCount)
{
CWinApp::OnIdle(lCount);
NS_DoIdleEmbeddingStuff();
return FALSE;
}
void CMfcEmbedApp::OnPreferences (){
CPreferencesDlg prefDlg;
prefDlg.DoModal();
}
void CMfcEmbedApp::OnManageProfiles()
{
m_ProfileMgr->DoManageProfilesDialog(PR_FALSE);
}
BOOL CMfcEmbedApp::InitializeProfiles()
{
m_ProfileMgr = new CProfileMgr;
if (!m_ProfileMgr)
return FALSE;
m_ProfileMgr->StartUp();
nsresult rv;
NS_WITH_SERVICE(nsIObserverService, observerService, NS_OBSERVERSERVICE_CONTRACTID, &rv);
observerService->AddObserver(this, PROFILE_APPROVE_CHANGE_TOPIC);
observerService->AddObserver(this, PROFILE_CHANGE_TEARDOWN_TOPIC);
observerService->AddObserver(this, PROFILE_AFTER_CHANGE_TOPIC);
return TRUE;
}
// When the profile switch happens, all open browser windows need to be
// closed.
// In order for that not to kill off the app, we just make the MFC app's
// mainframe be an invisible window which doesn't get closed on profile
// switches
BOOL CMfcEmbedApp::CreateHiddenWindow()
{
CFrameWnd *hiddenWnd = new CFrameWnd;
if(!hiddenWnd)
return FALSE;
RECT bounds = { -10010, -10010, -10000, -10000 };
hiddenWnd->Create(NULL, "main", WS_DISABLED, bounds, NULL, NULL, 0, NULL);
m_pMainWnd = hiddenWnd;
return TRUE;
}
nsresult CMfcEmbedApp::InitializePrefs()
{
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = InitializeCachePrefs();
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not initialize cache prefs");
// We are using the default prefs from mozilla. If you were
// disributing your own, this would be done simply by editing
// the default pref files.
PRBool inited;
rv = prefs->GetBoolPref("kmeleon.prefs_inited", &inited);
if (NS_FAILED(rv) || !inited)
{
rv = prefs->SetBoolPref("kmeleon.prefs_inited", PR_TRUE);
if (NS_SUCCEEDED(rv))
rv = prefs->SavePrefFile();
}
}
else
NS_ASSERTION(PR_FALSE, "Could not get preferences service");
return rv;
}
nsresult CMfcEmbedApp::InitializeCachePrefs()
{
const char * const CACHE_DIR_PREF = "browser.cache.directory";
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// See if we have a pref to a dir which exists
nsCOMPtr<nsILocalFile> prefDir;
rv = prefs->GetFileXPref(CACHE_DIR_PREF, getter_AddRefs(prefDir));
if (NS_SUCCEEDED(rv)) {
PRBool isDir;
rv = prefDir->IsDirectory(&isDir);
if (NS_SUCCEEDED(rv) && isDir)
return NS_OK;
}
// Set up the new pref
nsCOMPtr<nsIFile> profileDir;
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
NS_ASSERTION(profileDir, "NS_APP_USER_PROFILE_50_DIR is not defined");
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsILocalFile> cacheDir(do_QueryInterface(profileDir));
NS_ASSERTION(cacheDir, "Cannot get nsILocalFile from cache dir");
PRBool exists;
cacheDir->Append("Cache");
rv = cacheDir->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists)
rv = cacheDir->Create(nsIFile::DIRECTORY_TYPE, 0775);
if (NS_FAILED(rv)) return rv;
return prefs->SetFileXPref(CACHE_DIR_PREF, cacheDir);
}
// ---------------------------------------------------------------------------
// CMfcEmbedApp : nsISupports
// ---------------------------------------------------------------------------
NS_IMPL_THREADSAFE_ISUPPORTS2(CMfcEmbedApp, nsIObserver, nsISupportsWeakReference);
// ---------------------------------------------------------------------------
// CMfcEmbedApp : nsIObserver
// ---------------------------------------------------------------------------
// Mainly needed to support "on the fly" profile switching
NS_IMETHODIMP CMfcEmbedApp::Observe(nsISupports *aSubject, const PRUnichar *aTopic, const PRUnichar *someData)
{
nsresult rv = NS_OK;
if (nsCRT::strcmp(aTopic, PROFILE_APPROVE_CHANGE_TOPIC) == 0)
{
// Ask the user if they want to
int result = MessageBox(NULL, "Do you want to close all windows in order to switch the profile?", "Confirm", MB_YESNO | MB_ICONQUESTION);
if (result != IDYES)
{
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
NS_ENSURE_TRUE(status, NS_ERROR_FAILURE);
status->VetoChange();
}
}
else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_TOPIC) == 0)
{
// Close all open windows. Alternatively, we could just call CBrowserWindow::Stop()
// on each. Either way, we have to stop all network activity on this phase.
POSITION pos = m_FrameWndLst.GetHeadPosition();
while( pos != NULL )
{
CBrowserFrame *pBrowserFrame = (CBrowserFrame *) m_FrameWndLst.GetNext(pos);
if(pBrowserFrame)
{
pBrowserFrame->ShowWindow(false);
// Passing in FALSE below so that we do not
// kill the main app during a profile switch
RemoveFrameFromList(pBrowserFrame, FALSE);
pBrowserFrame->DestroyWindow();
}
}
NS_WITH_SERVICE(nsINetDataCacheManager, cacheMgr, NS_NETWORK_CACHE_MANAGER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
cacheMgr->Clear(nsINetDataCacheManager::MEM_CACHE);
}
else if (nsCRT::strcmp(aTopic, PROFILE_AFTER_CHANGE_TOPIC) == 0)
{
InitializePrefs(); // In case we have just switched to a newly created profile.
OnNewBrowser();
}
return rv;
}
// AboutDlg Stuff
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
enum { IDD = IDD_ABOUTBOX };
protected:
CString m_credits;
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
protected:
DECLARE_MESSAGE_MAP()
};
#define _QUOTE(blah) #blah
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
m_credits = _QUOTE(
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
\r\n
Contributors:\r\n
Christophe Thibault <christophe@nullsoft.com>\r\n
Brian Harris <binaryc@teamreaction.com>\r\n
Sebastian Spaeth <Sebastian@SSpaeth.de>\r\n
Chak Nanga <chak@netscape.com>\r\n
);
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX){
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_CREDITS, m_credits);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// Show the AboutDlg
void CMfcEmbedApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}

@ -0,0 +1,112 @@
/* -*- 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>
*/
// mozembed.h : main header file for the MOZEMBED application
//
#ifndef _MFCEMBED_H
#define _MFCEMBED_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include "Plugins.h"
#include "Preferences.h"
#include "MenuParser.h"
/////////////////////////////////////////////////////////////////////////////
// CMfcEmbedApp:
// See mozembed.cpp for the implementation of this class
//
class CBrowserFrame;
class CProfileMgr;
class CMfcEmbedApp : public CWinApp,
public nsIObserver,
public nsSupportsWeakReference
{
public:
CMfcEmbedApp();
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL,
PRInt32 x = -1, PRInt32 y = -1,
PRInt32 cx = -1, PRInt32 cy = -1,
PRBool bShowWindow = PR_TRUE);
void RemoveFrameFromList(CBrowserFrame* pFrm, BOOL bCloseAppOnLastFrame = TRUE);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMfcEmbedApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
virtual BOOL OnIdle(LONG lCount);
//}}AFX_VIRTUAL
CObList m_FrameWndLst;
CPlugins plugins;
CPreferences preferences;
CMenuParser menus;
// Implementation
public:
//{{AFX_MSG(CMfcEmbedApp)
afx_msg void OnAppAbout();
afx_msg void OnNewBrowser();
afx_msg void OnManageProfiles();
afx_msg void OnPreferences();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
BOOL InitializeProfiles();
BOOL CreateHiddenWindow();
nsresult InitializePrefs();
nsresult InitializeCachePrefs();
private:
CProfileMgr *m_ProfileMgr;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // _MFCEMBED_H

@ -0,0 +1,585 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\mfcembed.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_TOOLBAR_HOT BITMAP DISCARDABLE "res\\Tool2.bmp"
IDB_TOOLBAR_COLD BITMAP DISCARDABLE "res\\Tool1.bmp"
IDB_BACK BITMAP DISCARDABLE "res\\back.bmp"
IDB_TOOLBAR_DISABLED BITMAP DISCARDABLE "res\\Tool3.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New Browser Window\tCtrl+N", ID_NEW_BROWSER
MENUITEM SEPARATOR
MENUITEM "&Open File...\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Save Page As...\tCtrl+S", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
MENUITEM SEPARATOR
MENUITEM "Select &All", ID_EDIT_SELECT_ALL
MENUITEM "Select &None", ID_EDIT_SELECT_NONE
MENUITEM SEPARATOR
MENUITEM "Profiles...", ID_MANAGE_PROFILES
MENUITEM "Preferences...", ID_PREFERENCES
END
POPUP "&View"
BEGIN
MENUITEM "Page S&ource", ID_VIEW_SOURCE
MENUITEM "Page &Info", ID_VIEW_INFO
MENUITEM SEPARATOR
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
END
POPUP "&Go"
BEGIN
MENUITEM "&Back", ID_NAV_BACK
MENUITEM "&Forward", ID_NAV_FORWARD
MENUITEM "&Home", ID_NAV_HOME
END
POPUP "&Help"
BEGIN
MENUITEM "&About MfcEmbed...", ID_APP_ABOUT
END
END
IDR_CTXMENU_DOCUMENT MENU DISCARDABLE
BEGIN
POPUP "Document Context Menu"
BEGIN
MENUITEM "&Back", ID_NAV_BACK
MENUITEM "&Forward", ID_NAV_FORWARD
MENUITEM "&Reload", ID_NAV_RELOAD
MENUITEM "&Stop", ID_NAV_STOP
MENUITEM SEPARATOR
MENUITEM "&View Page Source", ID_VIEW_SOURCE
MENUITEM "View Page &Info", ID_VIEW_INFO
MENUITEM SEPARATOR
MENUITEM "Save &Page As...", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "Select &All", ID_EDIT_SELECT_ALL
MENUITEM "Select &None", ID_EDIT_SELECT_NONE
MENUITEM "&Copy", ID_EDIT_COPY
END
END
IDR_CTXMENU_IMAGE MENU DISCARDABLE
BEGIN
POPUP "Image Context Menu"
BEGIN
MENUITEM "&Back", ID_NAV_BACK
MENUITEM "&Forward", ID_NAV_FORWARD
MENUITEM "&Reload", ID_NAV_RELOAD
MENUITEM "&Stop", ID_NAV_STOP
MENUITEM SEPARATOR
MENUITEM "&View Page Source", ID_VIEW_SOURCE
MENUITEM "View &Image", ID_VIEW_IMAGE
MENUITEM SEPARATOR
MENUITEM "Save Image As...", ID_SAVE_IMAGE_AS
MENUITEM "Save &Page As...", ID_FILE_SAVE_AS
END
END
IDR_CTXMENU_LINK MENU DISCARDABLE
BEGIN
POPUP "Link Context Menu"
BEGIN
MENUITEM "Open Link In New Window", ID_OPEN_LINK_IN_NEW_WINDOW
MENUITEM SEPARATOR
MENUITEM "&Back", ID_NAV_BACK
MENUITEM "&Forward", ID_NAV_FORWARD
MENUITEM "&Reload", ID_NAV_RELOAD
MENUITEM "&Stop", ID_NAV_STOP
MENUITEM SEPARATOR
MENUITEM "&View Page Source", ID_VIEW_SOURCE
MENUITEM SEPARATOR
MENUITEM "Save &Page As...", ID_FILE_SAVE_AS
MENUITEM "Save &Link As...", ID_SAVE_LINK_AS
MENUITEM "&Copy Link Location", ID_COPY_LINK_LOCATION
END
END
IDR_CTXMENU_TEXT MENU DISCARDABLE
BEGIN
POPUP "Selection Context Menu"
BEGIN
MENUITEM "Cu&t", ID_EDIT_CUT
MENUITEM "&Copy", ID_EDIT_COPY
MENUITEM "&Paste", ID_EDIT_PASTE
MENUITEM "Select &All", ID_EDIT_SELECT_ALL
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
"N", ID_NEW_BROWSER, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"S", ID_FILE_SAVE_AS, VIRTKEY, CONTROL, NOINVERT
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 228, 121
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About K-Meleon"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,207,101,20,20
DEFPUSHBUTTON "OK",IDOK,196,0,32,14,WS_GROUP
EDITTEXT IDC_CREDITS,0,0,196,121,ES_MULTILINE | ES_AUTOVSCROLL |
ES_READONLY | WS_VSCROLL
END
IDD_PROMPT_DIALOG DIALOG DISCARDABLE 0, 0, 249, 82
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Prompt Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,130,61,50,14
PUSHBUTTON "Cancel",IDCANCEL,189,61,50,14
LTEXT "Please enter something....",IDC_PROMPT_TEXT,10,7,229,29
EDITTEXT IDC_PROMPT_ANSWER,10,39,229,14,ES_AUTOHSCROLL
END
IDD_PROMPT_PASSWORD_DIALOG DIALOG DISCARDABLE 0, 0, 248, 93
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
CAPTION "Password Entry Dialog"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Please enter your password:",IDC_PROMPT_TEXT,5,7,232,20
DEFPUSHBUTTON "OK",IDOK,129,75,50,14
PUSHBUTTON "Cancel",IDCANCEL,188,75,50,14
EDITTEXT IDC_PASSWORD,5,37,233,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Check1",IDC_CHECK_SAVE_PASSWORD,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,57,229,10
END
IDD_PROMPT_USERPASS_DIALOG DIALOG DISCARDABLE 0, 0, 214, 123
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Username and Password Required"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "This operation requires authentication. Please enter your user name and password:",
IDC_PROMPT_TEXT,6,9,171,25
LTEXT "User Name:",IDC_USERNAME_LABEL,6,39,39,9
EDITTEXT IDC_USERNAME,49,39,153,12,ES_AUTOHSCROLL
LTEXT "Password:",IDC_PASSWORD_LABEL,6,58,36,8
EDITTEXT IDC_PASSWORD,49,56,153,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Check1",IDC_CHECK_SAVE_PASSWORD,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,6,78,201,10
DEFPUSHBUTTON "OK",IDOK,40,101,50,14
PUSHBUTTON "Cancel",IDCANCEL,95,101,50,14
END
IDD_PROFILES DIALOG DISCARDABLE 0, 0, 196, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Manage Profiles"
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_LIST1,79,17,110,44,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Rename...",IDC_PROF_RENAME,7,7,50,14
PUSHBUTTON "Delete",IDC_PROF_DELETE,7,27,50,14
PUSHBUTTON "New...",IDC_PROF_NEW,7,48,50,14
DEFPUSHBUTTON "OK",IDOK,139,74,50,14
PUSHBUTTON "Cancel",IDCANCEL,80,74,50,14
CONTROL "Ask At Startup",IDC_CHECK_ASK_AT_START,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,75,61,10
END
IDD_PROFILE_NEW DIALOG DISCARDABLE 0, 0, 177, 79
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Profile"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_NEW_PROF_NAME,39,16,122,14,ES_AUTOHSCROLL
COMBOBOX IDC_LOCALE_COMBO,39,35,67,30,CBS_DROPDOWNLIST | CBS_SORT |
WS_DISABLED | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,120,58,50,14
PUSHBUTTON "Cancel",IDCANCEL,63,58,50,14
RTEXT "Name:",IDC_STATIC,13,18,22,8
RTEXT "Locale:",IDC_STATIC,11,37,24,8
END
IDD_PROFILE_RENAME DIALOG DISCARDABLE 0, 0, 177, 76
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rename Profile"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_NEW_NAME,50,16,113,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,120,55,50,14
PUSHBUTTON "Cancel",IDCANCEL,63,55,50,14
RTEXT "New Name:",IDC_STATIC,7,18,38,8
END
IDD_PREFERENCES DIALOGEX 0, 0, 345, 185
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Preferences"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,234,164,50,14
PUSHBUTTON "Cancel",IDCANCEL,288,164,50,14
CONTROL "List1",IDC_LIST1,"SysListView32",LVS_LIST |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT |
WS_BORDER | WS_TABSTOP,7,7,93,171
CONTROL "",IDC_CONTAINER,"Static",SS_ETCHEDFRAME,103,7,235,154
END
IDD_PREFERENCES_DISPLAY DIALOGEX 0, 0, 233, 154
STYLE WS_CHILD
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT_TOOLBAR_BACKGROUND,84,6,93,14,ES_AUTOHSCROLL
CONTROL "Toolbar Background",IDC_CHECK_TOOLBAR_BACKGROUND,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,4,8,80,10
PUSHBUTTON "Browse...",IDC_BUTTON_BROWSE,179,6,50,14
END
IDD_PREFERENCES_PROXY DIALOGEX 0, 0, 233, 154
STYLE WS_CHILD
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT_PROXY,51,4,178,14,ES_AUTOHSCROLL
LTEXT "Proxy Server:",IDC_STATIC,4,7,43,8
LTEXT "** Proxy Support Not Implemented Yet",IDC_STATIC,51,65,
120,8
END
IDD_PREFERENCES_GENERAL DIALOGEX 0, 0, 233, 154
STYLE WS_CHILD
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "Home Page:",IDC_STATIC,4,7,45,8
EDITTEXT IDC_EDIT_HOMEPAGE,49,4,180,14,ES_AUTOHSCROLL
LTEXT "When K-Meleon Starts, Display:",IDC_STATIC,4,24,101,8
CONTROL "Blank Page",IDC_RADIO_START_BLANK,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,113,23,53,10
CONTROL "Home Page",IDC_RADIO_START_HOME,"Button",
BS_AUTORADIOBUTTON,176,23,53,10
EDITTEXT IDC_EDIT_SETTINGS_DIR,49,43,180,14,ES_AUTOHSCROLL
LTEXT "Settings Dir:",IDC_STATIC,4,46,39,8
END
IDD_PREFERENCES_PLUGINS DIALOGEX 0, 0, 233, 154
STYLE WS_CHILD
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "List1",IDC_LIST_PLUGINS,"SysListView32",LVS_LIST |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT |
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,4,4,225,130
PUSHBUTTON "Configure",IDC_BUTTON_CONFIG,4,136,50,14
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "MfcEmbed MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "MfcEmbed\0"
VALUE "LegalCopyright", "Copyright (C) 2001\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "MfcEmbed.EXE\0"
VALUE "ProductName", "MfcEmbed Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_PROFILES, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 189
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
IDD_PROFILE_NEW, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 170
TOPMARGIN, 7
BOTTOMMARGIN, 72
END
IDD_PROFILE_RENAME, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 170
TOPMARGIN, 7
BOTTOMMARGIN, 69
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// AVI
//
IDR_MFCAVI AVI DISCARDABLE "res\\out.avi"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\MozillaBrowser.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
//
IDC_PAN_UP CURSOR DISCARDABLE "res\\Cursor_10.cur"
IDC_PAN_DOWN CURSOR DISCARDABLE "res\\Cursor_11.cur"
IDC_PAN_RIGHT CURSOR DISCARDABLE "res\\Cursor_12.cur"
IDC_PAN_LEFT CURSOR DISCARDABLE "res\\Cursor_13.cur"
IDC_PAN CURSOR DISCARDABLE "res\\Cursor_27.cur"
IDC_PAN_UPLEFT CURSOR DISCARDABLE "res\\Cursor_15.cur"
IDC_PAN_DOWNLEFT CURSOR DISCARDABLE "res\\Cursor_17.cur"
IDC_PAN_UPRIGHT CURSOR DISCARDABLE "res\\Cursor_14.cur"
IDC_PAN_DOWNRIGHT CURSOR DISCARDABLE "res\\Cursor_16.cur"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "K-Meleon"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "K-Meleon"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_CLEAR "Erase the selection\nErase"
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
ID_EDIT_FIND "Find the specified text\nFind"
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
ID_EDIT_UNDO "Undo the last action\nUndo"
ID_EDIT_REDO "Redo the previously undone action\nRedo"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_SELECT_NONE "Select nothing in the document\nSelect None"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\mfcembed.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

@ -0,0 +1,166 @@
/*
* 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.
*/
// this handles plugin loading/unloading
#include "StdAfx.h"
#include "MfcEmbed.h"
extern CMfcEmbedApp theApp;
#include "BrowserView.h"
#include "BrowserFrm.h"
#include "Plugins.h"
#include "kmeleon_plugin.h"
CPlugins::CPlugins(){
}
CPlugins::~CPlugins(){
POSITION pos = pluginList.GetStartPosition();
kmeleonPlugin * kPlugin;
CString s;
while (pos){
pluginList.GetNextAssoc( pos, s, kPlugin);
if (kPlugin){
kPlugin->Quit();
FreeLibrary(kPlugin->hDllInstance);
}
}
}
// returns a pointer to the char after the last \ or /
const char *FileNoPath(const char *filepath){
char *p1 = strrchr(filepath, '\\');
char *p2 = strrchr(filepath, '/');
if (p1 > p2){
return p1 + 1;
}
else if (p2 > p1){
return p2 + 1;
}
else{
return filepath;
}
}
UINT currentID = 2000;
UINT GetCommandIDs(int num){
UINT freeID = currentID;
currentID += num;
return freeID;
}
int CPlugins::OnUpdate(UINT command){
if (command >= 2000 && command <= currentID){
return true;
}
return false;
}
// TODO: when a plugin calls GetCommandIDs, register it, then only send them those messages
LRESULT CPlugins::OnMessage(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam){
/*