git-svn-id: http://svn.purei.org/purei/trunk@155 b36208d7-6611-0410-8bec-b1987f11c4a2

This commit is contained in:
jpd002 2007-10-26 18:24:20 +00:00
parent cd4f5907bf
commit cfaf40517c
6 changed files with 81 additions and 19 deletions

View File

@ -202,6 +202,10 @@
RelativePath="..\..\Source\win32ui\ELFView.cpp"
>
</File>
<File
RelativePath=".\Source\ElfViewEx.cpp"
>
</File>
<File
RelativePath=".\Source\ElfViewFrame.cpp"
>
@ -252,6 +256,10 @@
RelativePath="..\..\Source\win32ui\ELFView.h"
>
</File>
<File
RelativePath=".\Source\ElfViewEx.h"
>
</File>
<File
RelativePath=".\Source\ElfViewFrame.h"
>

View File

@ -0,0 +1,15 @@
#include "ElfViewEx.h"
using namespace Framework;
CElfViewEx::CElfViewEx(HWND parentWnd, CStream& stream) :
CELFView(parentWnd),
m_elf(&stream)
{
SetELF(&m_elf);
}
CElfViewEx::~CElfViewEx()
{
SetELF(NULL);
}

View File

@ -0,0 +1,19 @@
#ifndef _ELFVIEWEX_H_
#define _ELFVIEWEX_H_
#include "..\Purei\Source\ELF.h"
#include "..\Purei\Source\win32ui\ELFView.h"
class CElfViewEx : public CELFView
{
public:
CElfViewEx(HWND, Framework::CStream&);
virtual ~CElfViewEx();
protected:
private:
CELF m_elf;
};
#endif

View File

@ -1,11 +1,13 @@
#include "ElfViewFrame.h"
#include "win32/Rect.h"
#include "StdStream.h"
using namespace Framework;
#define CLSNAME _T("ElfViewFrame")
CElfViewFrame::CElfViewFrame()
CElfViewFrame::CElfViewFrame(const char* path) :
m_elfView(NULL)
{
if(!DoesWindowClassExist(CLSNAME))
{
@ -21,16 +23,27 @@ CElfViewFrame::CElfViewFrame()
}
Create(NULL, CLSNAME, _T("Elf Viewer"), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
Win32::CRect(0, 0, 640, 480), NULL, NULL);
Win32::CRect(0, 0, 770, 580), NULL, NULL);
SetClassPtr();
// SetMenu(LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_DEBUGGER)));
CreateClient(NULL);
m_elfView = Open(path);
}
CElfViewFrame::~CElfViewFrame()
{
if(m_elfView)
{
delete m_elfView;
}
}
CElfViewEx* CElfViewFrame::Open(const char* path)
{
CStdStream stream(path, "rb");
CElfViewEx* elfView = new CElfViewEx(m_pMDIClient->m_hWnd, stream);
elfView->SetTextA(path);
elfView->Show(SW_MAXIMIZE);
return elfView;
}

View File

@ -2,15 +2,17 @@
#define _ELFVIEWFRAME_H_
#include "win32/MDIFrame.h"
#include "ElfViewEx.h"
class CElfViewFrame : public Framework::Win32::CMDIFrame
{
public:
CElfViewFrame();
CElfViewFrame(const char*);
virtual ~CElfViewFrame();
private:
CElfViewEx* Open(const char*);
CElfViewEx* m_elfView;
};
#endif

View File

@ -1,21 +1,26 @@
#include <windows.h>
//#include "..\Purei\Source\ELF.h"
//#include "..\Purei\Source\win32ui\ELFView.h"
//#include "StdStream.h"
#include "ElfViewFrame.h"
#include <boost/algorithm/string.hpp>
using namespace Framework;
using namespace std;
using namespace boost;
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR params, int showCmd)
{
CElfViewFrame elfViewFrame;
elfViewFrame.Center();
elfViewFrame.Show(SW_SHOW);
// CStdStream stream("D:\\rar\\Purei\\psf2.irx", "rb");
// CELF elf(&stream);
// CELFView elfView(NULL);
// elfView.SetELF(&elf);
// elfView.Show(SW_SHOW);
Win32::CWindow::StdMsgLoop(&elfViewFrame);
try
{
string path(params);
erase_all(path, "\"");
CElfViewFrame elfViewFrame(path.c_str());
elfViewFrame.Center();
elfViewFrame.Show(SW_SHOW);
Win32::CWindow::StdMsgLoop(&elfViewFrame);
}
catch(const exception& except)
{
MessageBoxA(NULL, except.what(), NULL, 16);
// MessageBoxA(NULL, params, NULL, 16);
}
return 0;
}