Skip to content

Commit

Permalink
Working version of winelev.
Browse files Browse the repository at this point in the history
  • Loading branch information
akirmse committed Oct 6, 2015
1 parent 380c016 commit 1eb85d1
Show file tree
Hide file tree
Showing 377 changed files with 18,605 additions and 24,578 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
**/Debug/*
**/Release/*
**/Distribute/*
Debug/*
Release/*
Distribute/*
.vs/*
*.suo
*.ncb
*.aps
Distribute/*
*.sdf
ipch/*
*.opensdf
4,700 changes: 0 additions & 4,700 deletions hlp/~WRL0003.tmp

This file was deleted.

4,700 changes: 0 additions & 4,700 deletions hlp/~WRL0005.tmp

This file was deleted.

96 changes: 96 additions & 0 deletions winelev/BackgdTask_dlg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// BackgroundTask_dlg.cpp : implementation file
//

#include "stdafx.h"
#include "resource.h"
#include "BackgdTask_dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


static UINT thread_entry(CBackgdTask_dlg *myself)
{
int result=myself->proc();
CBackgdTask_dlg::current_backgd_task=myself;
AfxGetApp()->PostThreadMessage(IDT_BACKGD_TASK_DONE,result,0);
return 0;
}


/////////////////////////////////////////////////////////////////////////////
// CBackgdTask_dlg dialog

CBackgdTask_dlg::CBackgdTask_dlg(UINT dlgResource)
: CDialog(dlgResource)
{
//{{AFX_DATA_INIT(CBackgdTask_dlg)
//}}AFX_DATA_INIT
}

void CBackgdTask_dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBackgdTask_dlg)
DDX_Control(pDX, IDSUSPEND, m_suspend);
DDX_Control(pDX, IDCANCEL, m_cancel);
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBackgdTask_dlg, CDialog)
//{{AFX_MSG_MAP(CBackgdTask_dlg)
ON_BN_CLICKED(IDSUSPEND, OnSuspend)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

CBackgdTask_dlg *CBackgdTask_dlg::current_backgd_task;


/////////////////////////////////////////////////////////////////////////////
// CBackgdTask_dlg message handlers

BOOL CBackgdTask_dlg::OnInitDialog()
{
CDialog::OnInitDialog();

running=true;
stop_request=false;
pThread=AfxBeginThread((AFX_THREADPROC)thread_entry,this);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

void CBackgdTask_dlg::OnSuspend()
{
if (pThread==0) CDialog::OnOK();
else if (running) {
pThread->SuspendThread();
m_suspend.SetWindowText("&Resume");
running=false;
}
else {
pThread->ResumeThread();
m_suspend.SetWindowText("&Suspend");
running=true;
}
}

void CBackgdTask_dlg::OnCancel()
{
if (pThread!=0) stop_request=true;
else CDialog::OnCancel();
}

void CBackgdTask_dlg::OnDone(WPARAM result)
{
if (result!=0) EndDialog(result);
else {
m_suspend.SetWindowText("OK");
pThread=0;
}
}
61 changes: 61 additions & 0 deletions winelev/BackgdTask_dlg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#if !defined(AFX_BACKGDTASK_DLG_H__99468940_7622_11D5_A238_509152C10000__INCLUDED_)
#define AFX_BACKGDTASK_DLG_H__99468940_7622_11D5_A238_509152C10000__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BackgroundTask_dlg.h : header file
//

#define IDD_BACKGROUND -1 // dummy
#define IDT_BACKGD_TASK_DONE 257


/////////////////////////////////////////////////////////////////////////////
// CBackgdTask_dlg dialog

class CBackgdTask_dlg : public CDialog
{
bool running;
CWinThread *pThread;
friend UINT thread_entry(CBackgdTask_dlg *);

// Construction
public:
CBackgdTask_dlg(UINT);

void OnDone(WPARAM);

// Dialog Data
//{{AFX_DATA(CBackgdTask_dlg)
enum { IDD = IDD_BACKGROUND };
CButton m_suspend;
CButton m_cancel;
//}}AFX_DATA

bool stop_request;
static CBackgdTask_dlg *current_backgd_task;

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBackgdTask_dlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
virtual int proc() throw() = 0;

// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CBackgdTask_dlg)
virtual void OnCancel();
afx_msg void OnSuspend();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BACKGDTASK_DLG_H__99468940_7622_11D5_A238_509152C10000__INCLUDED_)
49 changes: 49 additions & 0 deletions winelev/BdyWarn_dlg_old.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// BdyWarn_dlg.cpp : implementation file
//

#include "stdafx.h"
#include "winelev.h"
#include "BdyWarn_dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CBdyWarn_dlg dialog

CBdyWarn_dlg::CBdyWarn_dlg(CWnd* pParent /*=NULL*/)
: CDialog(CBdyWarn_dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBdyWarn_dlg)
m_file1 = _T("");
m_file2 = _T("");
m_reprompt = FALSE;
m_warn_type = _T("");
//}}AFX_DATA_INIT
}

void CBdyWarn_dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBdyWarn_dlg)
DDX_Text(pDX, IDC_FILE1, m_file1);
DDX_Text(pDX, IDC_FILE2, m_file2);
DDX_Check(pDX, IDC_REPROMPT, m_reprompt);
DDX_Text(pDX, IDC_WARN_TYPE, m_warn_type);
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBdyWarn_dlg, CDialog)
//{{AFX_MSG_MAP(CBdyWarn_dlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CBdyWarn_dlg message handlers
49 changes: 49 additions & 0 deletions winelev/BdyWarn_dlg_old.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#if !defined(AFX_BDYWARN_DLG_H__9EEB3381_BB63_4B91_8F03_BA5F2F8672FF__INCLUDED_)
#define AFX_BDYWARN_DLG_H__9EEB3381_BB63_4B91_8F03_BA5F2F8672FF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BdyWarn_dlg.h : header file
//


/////////////////////////////////////////////////////////////////////////////
// CBdyWarn_dlg dialog

class CBdyWarn_dlg : public CDialog
{
// Construction
public:
CBdyWarn_dlg(CWnd* pParent = NULL); // standard constructor

// Dialog Data
//{{AFX_DATA(CBdyWarn_dlg)
enum { IDD = IDD_BDY_WARNING };
CString m_file1;
CString m_file2;
BOOL m_reprompt;
CString m_warn_type;
//}}AFX_DATA

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBdyWarn_dlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:

// Generated message map functions
//{{AFX_MSG(CBdyWarn_dlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BDYWARN_DLG_H__9EEB3381_BB63_4B91_8F03_BA5F2F8672FF__INCLUDED_)
97 changes: 97 additions & 0 deletions winelev/ConvertCtl_dlg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// ConvertCtl_dlg.cpp : implementation file
//

#include "stdafx.h"
#include <sys/types.h>
#include <sys/stat.h>
#include "winelev.h"
#include "ConvertCtl_dlg.h"
#include "Elev_dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CConvertCtl_dlg dialog

CConvertCtl_dlg::CConvertCtl_dlg(CElev_dlg& ed)
: CBackgdTask_dlg(CConvertCtl_dlg::IDD),elev_win(ed)
{
//{{AFX_DATA_INIT(CConvertCtl_dlg)
m_fromfile = _T("");
m_stage = _T("");
//}}AFX_DATA_INIT
}


void CConvertCtl_dlg::DoDataExchange(CDataExchange* pDX)
{
CBackgdTask_dlg::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConvertCtl_dlg)
DDX_Control(pDX, IDC_PROGRESS, m_progress);
DDX_Text(pDX, IDC_FROMFILE, m_fromfile);
DDX_Text(pDX, IDC_STAGE, m_stage);
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CConvertCtl_dlg, CBackgdTask_dlg)
//{{AFX_MSG_MAP(CConvertCtl_dlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CConvertCtl_dlg message handlers

BOOL CConvertCtl_dlg::OnInitDialog()
{
CBackgdTask_dlg::OnInitDialog();

int total_steps=0;
FromType from_type;
CString path;

POSITION p=elev_win.files_dlg->GetStartPosition();
while (p!=NULL) {
path=elev_win.files_dlg->GetNextPathName(p);
from_type=elev_win.get_from_type(path);
if (from_type!=FROM_ELEV) ++total_steps; // external to native conversion
if (elev_win.m_to_divtree || elev_win.m_to_domap) {
// analysis
struct _stat stat;
if (from_type==FROM_GTOPO30) {
if (_stat(path,&stat)==0) {
if (stat.st_size==58320000L) total_steps+=36;
else if (stat.st_size==57600000L) total_steps+=80;
else if (stat.st_size==51840000L) total_steps+=72;
}
}
else if (from_type==FROM_GLOBE) {
if (_stat(path,&stat)==0) {
if (stat.st_size==129600000L) total_steps+=180;
else if (stat.st_size==103680000L) total_steps+=144;
}
}
else if (from_type==FROM_ETOPO2) {
total_steps+=72;
}
else ++total_steps;
}
}

m_progress.SetRange(0,total_steps);
m_progress.SetStep(1);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

int CConvertCtl_dlg::proc() throw()
{
return elev_win.convert_files();
}
Loading

0 comments on commit 1eb85d1

Please sign in to comment.