Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pgvoorhees committed Sep 29, 2016
0 parents commit 935c0ed
Show file tree
Hide file tree
Showing 88 changed files with 16,477 additions and 0 deletions.
479 changes: 479 additions & 0 deletions AccountDlg.cpp

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions AccountDlg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2011-2016 MicroSIP (http://www.microsip.org)
*
* 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 of the License, 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
*/

#pragma once

#include "resource.h"
#include "const.h"
#include "settings.h"

class AccountDlg :
public CDialog
{
public:
//CFont m_font;
AccountDlg(CWnd* pParent = NULL); // standard constructor
~AccountDlg();
enum { IDD = IDD_ACCOUNT };

void Load(int id);

private:
int accountId;
Account m_Account;

protected:
virtual BOOL OnInitDialog();
virtual void PostNcDestroy();
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnClose();
afx_msg void OnBnClickedCancel();
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedDelete();
afx_msg void OnNMClickSyslinkSipServer(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkSipProxy(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkUsername(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkDomain(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkAuthID(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkPassword(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkName(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkEncryption(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkTransport(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkPublicAddress(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkPublishPresence(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkStunServer(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkIce(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkRewrite(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkDisplayPasswod(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickSyslinkDelete(NMHDR *pNMHDR, LRESULT *pResult);
};
94 changes: 94 additions & 0 deletions AddDlg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright (C) 2011-2016 MicroSIP (http://www.microsip.org)
*
* 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 of the License, 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 "microsip.h"
#include "AddDlg.h"
#include "mainDlg.h"
#include "langpack.h"

AddDlg::AddDlg(CWnd* pParent /*=NULL*/)
: CDialog(AddDlg::IDD, pParent)
{
Create (IDD, pParent);
}

AddDlg::~AddDlg()
{
}

int AddDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (langPack.rtl) {
ModifyStyleEx(0,WS_EX_LAYOUTRTL);
}
return 0;
}

BOOL AddDlg::OnInitDialog()
{
CDialog::OnInitDialog();
TranslateDialog(this->m_hWnd);
return TRUE;
}

void AddDlg::PostNcDestroy()
{
CDialog::PostNcDestroy();
delete this;
}


BEGIN_MESSAGE_MAP(AddDlg, CDialog)
ON_WM_CREATE()
ON_WM_CLOSE()
ON_BN_CLICKED(IDOK, &AddDlg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &AddDlg::OnBnClickedCancel)
END_MESSAGE_MAP()


void AddDlg::OnClose()
{
this->ShowWindow(SW_HIDE);
}

void AddDlg::OnBnClickedOk()
{
CString number;
CString name;
BOOL presence;

GetDlgItem(IDC_EDIT_NUMBER)->GetWindowText(number);
number=number.Trim();
if (number.GetLength()) {
GetDlgItem(IDC_EDIT_NAME)->GetWindowText(name);
name=name.Trim();
name=name.GetLength()?name:number;
if (listIndex != -1) {
mainDlg->pageContacts->ContactDelete(listIndex, true);
}
presence = ((CButton*)GetDlgItem(IDC_PRESENCE))->GetCheck();
mainDlg->pageContacts->ContactAdd(number, name, presence, -1, TRUE);
OnClose();
}
}

void AddDlg::OnBnClickedCancel()
{
OnClose();
}
40 changes: 40 additions & 0 deletions AddDlg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2011-2016 MicroSIP (http://www.microsip.org)
*
* 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 of the License, 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
*/

#pragma once

class AddDlg : public CDialog
{

public:
AddDlg(CWnd* pParent = NULL);
virtual ~AddDlg();
enum { IDD = IDD_ADD };

int listIndex;

protected:
virtual BOOL OnInitDialog();
virtual void PostNcDestroy();
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnClose();
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedCancel();
};
156 changes: 156 additions & 0 deletions BaseDialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* Copyright (C) 2011-2016 MicroSIP (http://www.microsip.org)
*
* 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 of the License, 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 "BaseDialog.h"
#include "resource.h"

CBaseDialog::CBaseDialog(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
: CDialog(nIDTemplate, pParent),
m_szMinimum(0, 0)
{
}


BEGIN_MESSAGE_MAP(CBaseDialog, CDialog)
//{{AFX_MSG_MAP(CBaseDialog)
ON_WM_GETMINMAXINFO()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CBaseDialog::PreTranslateMessage(MSG* pMsg)
{
BOOL catched = FALSE;
if (pMsg->message == WM_KEYDOWN) {
if (GetAsyncKeyState(VK_CONTROL)<0) {
if (pMsg->wParam == 'M') {
PostMessage(WM_COMMAND,ID_ACCOUNT_EDIT_RANGE,0);
catched = TRUE;
}
if (pMsg->wParam == 'P') {
PostMessage(WM_COMMAND,ID_SETTINGS,0);
catched = TRUE;
}
if (pMsg->wParam == 'W') {
PostMessage(WM_COMMAND,ID_WEBSITE,0);
catched = TRUE;
}
if (pMsg->wParam == 'X') {
PostMessage(WM_COMMAND,ID_EXIT,0);
catched = TRUE;
}
}
}
if (!catched) {
return CDialog::PreTranslateMessage(pMsg);
} else {
return TRUE;
}
}

void CBaseDialog::AutoMove(int iID, double dXMovePct, double dYMovePct, double dXSizePct, double dYSizePct)
{
ASSERT((dXMovePct + dXSizePct) <= 100.0); // can't use more than 100% of the resize for the child
ASSERT((dYMovePct + dYSizePct) <= 100.0); // can't use more than 100% of the resize for the child
SMovingChild s;
GetDlgItem(iID, &s.m_hWnd);
ASSERT(s.m_hWnd != NULL);
s.m_dXMoveFrac = dXMovePct / 100.0;
s.m_dYMoveFrac = dYMovePct / 100.0;
s.m_dXSizeFrac = dXSizePct / 100.0;
s.m_dYSizeFrac = dYSizePct / 100.0;
::GetWindowRect(s.m_hWnd, &s.m_rcInitial);
ScreenToClient(s.m_rcInitial);
m_MovingChildren.push_back(s);
}

void CBaseDialog::AutoMove(HWND hWnd, double dXMovePct, double dYMovePct, double dXSizePct, double dYSizePct)
{
ASSERT((dXMovePct + dXSizePct) <= 100.0); // can't use more than 100% of the resize for the child
ASSERT((dYMovePct + dYSizePct) <= 100.0); // can't use more than 100% of the resize for the child
SMovingChild s;
s.m_hWnd = hWnd;
ASSERT(s.m_hWnd != NULL);
s.m_dXMoveFrac = dXMovePct / 100.0;
s.m_dYMoveFrac = dYMovePct / 100.0;
s.m_dXSizeFrac = dXSizePct / 100.0;
s.m_dYSizeFrac = dYSizePct / 100.0;
::GetWindowRect(s.m_hWnd, &s.m_rcInitial);
ScreenToClient(s.m_rcInitial);
m_MovingChildren.push_back(s);
}


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

// use the initial dialog size as the default minimum
if ((m_szMinimum.cx == 0) && (m_szMinimum.cy == 0))
{
CRect rcWindow;
GetWindowRect(rcWindow);
m_szMinimum = rcWindow.Size();
}

// keep the initial size of the client area as a baseline for moving/sizing controls
CRect rcClient;
GetClientRect(rcClient);
m_szInitial = rcClient.Size();

return TRUE; // return TRUE unless you set the focus to a control
}

void CBaseDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
CDialog::OnGetMinMaxInfo(lpMMI);

if (lpMMI->ptMinTrackSize.x < m_szMinimum.cx)
lpMMI->ptMinTrackSize.x = m_szMinimum.cx;
if (lpMMI->ptMinTrackSize.y < m_szMinimum.cy)
lpMMI->ptMinTrackSize.y = m_szMinimum.cy;
}

void CBaseDialog::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);

int iXDelta = cx - m_szInitial.cx;
int iYDelta = cy - m_szInitial.cy;
HDWP hDefer = NULL;
for (MovingChildren::iterator p = m_MovingChildren.begin(); p != m_MovingChildren.end(); ++p)
{
if (p->m_hWnd != NULL)
{
CRect rcNew(p->m_rcInitial);
rcNew.OffsetRect(int(iXDelta * p->m_dXMoveFrac), int(iYDelta * p->m_dYMoveFrac));
rcNew.right += int(iXDelta * p->m_dXSizeFrac);
rcNew.bottom += int(iYDelta * p->m_dYSizeFrac);
if (hDefer == NULL)
hDefer = BeginDeferWindowPos(m_MovingChildren.size());
UINT uFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER;
if ((p->m_dXSizeFrac != 0.0) || (p->m_dYSizeFrac != 0.0))
uFlags |= SWP_NOCOPYBITS;
DeferWindowPos(hDefer, p->m_hWnd, NULL, rcNew.left, rcNew.top, rcNew.Width(), rcNew.Height(), uFlags);
}
}
if (hDefer != NULL)
EndDeferWindowPos(hDefer);

}
Loading

0 comments on commit 935c0ed

Please sign in to comment.