| 1 |
/* AbiWord |
| 2 |
* Copyright (C) 1998-2000 AbiSource, Inc. |
| 3 |
* Copyright (C) 2002 Tomas Frydrych <[email protected]> |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU General Public License |
| 7 |
* as published by the Free Software Foundation; either version 2 |
| 8 |
* of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 |
* 02110-1301 USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
#include <windows.h> |
| 22 |
#include <commctrl.h> |
| 23 |
|
| 24 |
#include "ut_string.h" |
| 25 |
#include "ut_assert.h" |
| 26 |
#include "ut_debugmsg.h" |
| 27 |
|
| 28 |
#include "xap_App.h" |
| 29 |
#include "xap_Win32App.h" |
| 30 |
#include "xap_Win32FrameImpl.h" |
| 31 |
|
| 32 |
#include "xap_Dialog_Id.h" |
| 33 |
#include "xap_Dlg_DocComparison.h" |
| 34 |
#include "xap_Win32Dlg_DocComparison.h" |
| 35 |
#include "xap_Win32LabelledSeparator.h" |
| 36 |
|
| 37 |
#include "xap_Win32Resources.rc2" |
| 38 |
#include "xap_Win32DialogHelper.h" |
| 39 |
|
| 40 |
/*****************************************************************/ |
| 41 |
|
| 42 |
XAP_Dialog * XAP_Win32Dialog_DocComparison::static_constructor(XAP_DialogFactory * pFactory, |
| 43 |
XAP_Dialog_Id id) |
| 44 |
{ |
| 45 |
XAP_Win32Dialog_DocComparison * p = new XAP_Win32Dialog_DocComparison(pFactory,id); |
| 46 |
return p; |
| 47 |
} |
| 48 |
|
| 49 |
XAP_Win32Dialog_DocComparison::XAP_Win32Dialog_DocComparison(XAP_DialogFactory * pDlgFactory, |
| 50 |
XAP_Dialog_Id id) |
| 51 |
: XAP_Dialog_DocComparison(pDlgFactory,id) |
| 52 |
{ |
| 53 |
} |
| 54 |
|
| 55 |
XAP_Win32Dialog_DocComparison::~XAP_Win32Dialog_DocComparison(void) |
| 56 |
{ |
| 57 |
} |
| 58 |
|
| 59 |
void XAP_Win32Dialog_DocComparison::runModal(XAP_Frame * pFrame) |
| 60 |
{ |
| 61 |
XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp); |
| 62 |
|
| 63 |
XAP_Win32LabelledSeparator_RegisterClass(pWin32App); |
| 64 |
|
| 65 |
UT_ASSERT(m_id == XAP_DIALOG_ID_DOCCOMPARISON); |
| 66 |
createModal(pFrame, MAKEINTRESOURCEW(XAP_RID_DIALOG_DOCCOMPARISON)); |
| 67 |
} |
| 68 |
|
| 69 |
BOOL XAP_Win32Dialog_DocComparison::_onInitDialog(HWND /*hWnd*/, WPARAM /*wParam*/, LPARAM /*lParam*/) |
| 70 |
{ |
| 71 |
// set the window title |
| 72 |
setDialogTitle (getWindowLabel()); |
| 73 |
|
| 74 |
// localize buttons |
| 75 |
setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_BTN_OK,getButtonLabel()); |
| 76 |
|
| 77 |
// set frame titles |
| 78 |
setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_FRAME1,getFrame1Label()); |
| 79 |
setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_FRAME2,getFrame2Label()); |
| 80 |
|
| 81 |
// fill frame 1 |
| 82 |
char * p = getPath1(); |
| 83 |
if (!p) p = g_strdup("FIXME: Invalid Path1"); |
| 84 |
setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_PATH1,p); |
| 85 |
FREEP(p); |
| 86 |
|
| 87 |
p = getPath2(); |
| 88 |
if (!p) p = g_strdup("FIXME: Invalid Path2"); |
| 89 |
setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_PATH2,p); |
| 90 |
FREEP(p); |
| 91 |
|
| 92 |
// fill frame 2 |
| 93 |
UT_uint32 i; |
| 94 |
UT_uint32 k1 = XAP_RID_DIALOG_DOCCOMPARISON_LABEL_RELATIONSHIP; |
| 95 |
UT_uint32 k2 = XAP_RID_DIALOG_DOCCOMPARISON_RELATIONSHIP; |
| 96 |
|
| 97 |
for(i = 0; i < getResultCount(); i++) |
| 98 |
{ |
| 99 |
setDlgItemText(k1 + i,getResultLabel(i)); |
| 100 |
|
| 101 |
char * t = getResultValue(i); |
| 102 |
setDlgItemText(k2 + i, t); |
| 103 |
FREEP(t); |
| 104 |
} |
| 105 |
|
| 106 |
centerDialog(); |
| 107 |
return 1; // 1 == we did not call SetFocus() |
| 108 |
} |
| 109 |
|
| 110 |
BOOL XAP_Win32Dialog_DocComparison::_onCommand(HWND hWnd, WPARAM wParam, LPARAM /*lParam*/) |
| 111 |
{ |
| 112 |
WORD wId = LOWORD(wParam); |
| 113 |
|
| 114 |
switch (wId) |
| 115 |
{ |
| 116 |
case IDOK: |
| 117 |
case IDCANCEL: |
| 118 |
EndDialog(hWnd,0); |
| 119 |
return 1; |
| 120 |
|
| 121 |
default: // we did not handle this notification |
| 122 |
UT_DEBUGMSG(("WM_Command for id %ld\n",wId)); |
| 123 |
return 0; // return zero to let windows take care of it. |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
|