Hi guys!
I'm sending you a new patch to implement the Insert Date and Time Dialog for
Win32. See the attachment.
Also I've got a question. Is it good if I implement overwrite mode?
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/af/xap/win/xap_Win32Dlg_FontChooser.cpp
src/af/xap/win/xap_Win32Dlg_FontChooser.cpp
--- ..\abi.org\src\/af/xap/win/xap_Win32Dlg_FontChooser.cpp Wed Dec 29 16:12:41
1999
+++ src/af/xap/win/xap_Win32Dlg_FontChooser.cpp Sat Jan 15 12:24:48 2000
@@ -188,7 +188,7 @@
m_bChangedUnderline = (lf.lfUnderline != m_bUnderline);
m_bChangedStrikeOut = (lf.lfStrikeOut != m_bStrikeOut);
if (m_bChangedUnderline || m_bChangedStrikeOut)
- setFontDecoration(lf.lfUnderline,lf.lfStrikeOut);
+ setFontDecoration(lf.lfUnderline,UT_FALSE,lf.lfStrikeOut);
}
UT_DEBUGMSG(("FontChooserEnd: Family[%s%s] Size[%s%s] Weight[%s%s] Style[%s%s]
Color[%s%s] Underline[%d%s] StrikeOut[%d%s]\n",
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/Makefile src/wp/ap/Makefile
--- ..\abi.org\src\/wp/ap/Makefile Wed Dec 29 18:34:43 1999
+++ src/wp/ap/Makefile Wed Jan 05 18:21:13 2000
@@ -33,6 +33,7 @@
$(OBJDIR)/ap_$(ABI_FE)Dialog_Options.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_$(ABI_FE)Dialog_Paragraph.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_$(ABI_FE)Dialog_Replace.$(OBJ_SUFFIX) \
+ $(OBJDIR)/ap_$(ABI_FE)Dialog_Insert_DateTime.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_$(ABI_FE)Dialog_Spell.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_$(ABI_FE)Frame.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_$(ABI_FE)LeftRuler.$(OBJ_SUFFIX) \
@@ -76,6 +77,7 @@
$(OBJDIR)/ap_Dialog_Paragraph.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_Dialog_Replace.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_Dialog_Spell.$(OBJ_SUFFIX) \
+ $(OBJDIR)/ap_Dialog_Insert_DateTime.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_EditMethods.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_FrameData.$(OBJ_SUFFIX) \
$(OBJDIR)/ap_LeftRuler.$(OBJ_SUFFIX) \
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/win/Makefile src/wp/ap/win/Makefile
--- ..\abi.org\src\/wp/ap/win/Makefile Wed Dec 29 19:12:19 1999
+++ src/wp/ap/win/Makefile Thu Jan 06 14:52:29 2000
@@ -32,6 +32,7 @@
ap_$(ABI_FE)Dialog_Replace.cpp \
ap_$(ABI_FE)Dialog_Paragraph.cpp \
ap_$(ABI_FE)Dialog_Spell.cpp \
+ ap_$(ABI_FE)Dialog_Insert_DateTime.cpp \
ap_$(ABI_FE)Frame.cpp \
ap_$(ABI_FE)LeftRuler.cpp \
ap_$(ABI_FE)Prefs.cpp \
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/win/ap_Win32Dialog_All.h
src/wp/ap/win/ap_Win32Dialog_All.h
--- ..\abi.org\src\/wp/ap/win/ap_Win32Dialog_All.h Wed Dec 29 19:12:46 1999
+++ src/wp/ap/win/ap_Win32Dialog_All.h Thu Jan 06 15:05:23 2000
@@ -43,6 +43,7 @@
# include "ap_Win32Dialog_Options.h"
# include "ap_Win32Dialog_Paragraph.h"
# include "ap_Win32Dialog_Spell.h"
+# include "ap_Win32Dialog_Insert_DateTime.h"
// ... add new dialogs here ...
@@ -64,6 +65,7 @@
DeclareDialog(AP_DIALOG_ID_SPELL, AP_Win32Dialog_Spell)
DeclareDialog(AP_DIALOG_ID_OPTIONS, AP_Win32Dialog_Options)
DeclareDialog(AP_DIALOG_ID_PARAGRAPH, AP_Win32Dialog_Paragraph)
+ DeclareDialog(AP_DIALOG_ID_INSERT_DATETIME, AP_Win32Dialog_Insert_DateTime)
// ... also add new dialogs here ...
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp
src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp
--- ..\abi.org\src\/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp Thu Jan 01
03:00:00 1970
+++ src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp Thu Jan 13 17:03:30 2000
@@ -0,0 +1,158 @@
+/* AbiWord
+ * Copyright (C) 1998 AbiSource, Inc.
+ *
+ * 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 <windows.h>
+#include <time.h>
+
+#include "ut_string.h"
+#include "ut_assert.h"
+#include "ut_debugmsg.h"
+
+#include "xap_App.h"
+#include "xap_Win32App.h"
+#include "xap_Win32Frame.h"
+
+#include "ap_Strings.h"
+#include "ap_Dialog_Id.h"
+#include "ap_Dialog_Insert_DateTime.h"
+#include "ap_Win32Dialog_Insert_DateTime.h"
+
+#include "ap_Win32Resources.rc2"
+
+/*****************************************************************/
+
+AP_Win32Dialog_Insert_DateTime::AP_Win32Dialog_Insert_DateTime(XAP_DialogFactory *
+pDlgFactory,
+ XAP_Dialog_Id id)
+ : AP_Dialog_Insert_DateTime(pDlgFactory,id)
+{
+}
+
+/*****************************************************************/
+
+XAP_Dialog * AP_Win32Dialog_Insert_DateTime::static_constructor(XAP_DialogFactory *
+pFactory,
+ XAP_Dialog_Id id)
+{
+ AP_Win32Dialog_Insert_DateTime * p = new
+AP_Win32Dialog_Insert_DateTime(pFactory,id);
+ return p;
+}
+
+/*****************************************************************/
+
+void AP_Win32Dialog_Insert_DateTime::runModal(XAP_Frame * pFrame)
+{
+ // raise the dialog
+ XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
+ XAP_Win32Frame * pWin32Frame = static_cast<XAP_Win32Frame *>(pFrame);
+
+ LPCTSTR lpTemplate = NULL;
+
+ UT_ASSERT(m_id == AP_DIALOG_ID_INSERT_DATETIME);
+
+ lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_INSERT_DATETIME);
+
+ int result = DialogBoxParam(pWin32App->getInstance(),lpTemplate,
+ pWin32Frame->getTopLevelWindow(),
+ (DLGPROC)s_dlgProc,(LPARAM)this);
+ UT_ASSERT((result != -1));
+}
+
+BOOL CALLBACK AP_Win32Dialog_Insert_DateTime::s_dlgProc(HWND hWnd,UINT msg,WPARAM
+wParam,LPARAM lParam)
+{
+ // This is a static function.
+
+ AP_Win32Dialog_Insert_DateTime * pThis;
+
+
+ switch (msg){
+ case WM_INITDIALOG:
+ pThis = (AP_Win32Dialog_Insert_DateTime *)lParam;
+ SetWindowLong(hWnd,DWL_USER,lParam);
+ return pThis->_onInitDialog(hWnd,wParam,lParam);
+
+ case WM_COMMAND:
+ pThis = (AP_Win32Dialog_Insert_DateTime *)GetWindowLong(hWnd,DWL_USER);
+ return pThis->_onCommand(hWnd,wParam,lParam);
+
+ default:
+ return 0;
+ }
+}
+
+void AP_Win32Dialog_Insert_DateTime::SetFormatsList(void)
+{
+ int i;
+ char szCurrentDateTime[CURRENT_DATE_TIME_SIZE];
+ time_t tim = time(NULL);
+ struct tm *pTime = localtime(&tim);
+
+ for (i = 0;InsertDateTimeFmts[i] != NULL;i++) {
+ strftime(szCurrentDateTime, CURRENT_DATE_TIME_SIZE, InsertDateTimeFmts[i],
+pTime);
+ SendMessage(m_hwndFormats, LB_ADDSTRING, 0, (LPARAM)szCurrentDateTime);
+ }
+}
+
+BOOL AP_Win32Dialog_Insert_DateTime::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM
+lParam)
+{
+ m_hwndFormats = GetDlgItem(hWnd, AP_RID_DIALOG_INSERT_DATETIME_FORMAT_LISTBOX);
+ SetFormatsList();
+ SendMessage(m_hwndFormats,LB_SETCURSEL,(WPARAM)0,(LPARAM)0);
+ return 1; // 1 == we did not call SetFocus()
+}
+
+BOOL AP_Win32Dialog_Insert_DateTime::_onCommand(HWND hWnd, WPARAM wParam, LPARAM
+lParam)
+{
+ WORD wNotifyCode = HIWORD(wParam);
+ WORD wId = LOWORD(wParam);
+ HWND hWndCtrl = (HWND)lParam;
+
+ switch (wId){
+ case IDCANCEL: // also AP_RID_DIALOG_BREAK_BTN_CANCEL
+ m_answer = a_CANCEL;
+ // fall through
+
+ case IDOK: // also AP_RID_DIALOG_BREAK_BTN_OK
+ EndDialog(hWnd,0);
+ return 1;
+ case AP_RID_DIALOG_INSERT_DATETIME_FORMAT_LISTBOX:
+ switch (HIWORD(wParam)){
+ case LBN_SELCHANGE:
+ _FormatListBoxChange();
+ return 1;
+
+ case LBN_DBLCLK:
+ EndDialog(hWnd,0);
+ return 1;
+
+ default:
+ return 0;
+ }
+ break;
+ default: // we did not handle this notification
+ UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
+ return 0; // return zero to let windows take care of it.
+ }
+}
+
+
+void AP_Win32Dialog_Insert_DateTime::_FormatListBoxChange(void)
+{
+ m_iFormatIndex = SendMessage(m_hwndFormats, LB_GETCURSEL, 0, 0);
+// SendMessage(m_hwndFormats,LB_GETTEXT,iSelectedRow,(LPARAM)m_szCurrentDateTime);
+}
+
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h
src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h
--- ..\abi.org\src\/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h Thu Jan 01 03:00:00
1970
+++ src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h Thu Jan 13 16:59:54 2000
@@ -0,0 +1,45 @@
+/* AbiWord
+ * Copyright (C) 1998 AbiSource, Inc.
+ *
+ * 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.
+ */
+
+#ifndef AP_WIN32DIALOG_INSERT_DATETIME_H
+#define AP_WIN32DIALOG_INSERT_DATETIME_H
+
+#include "ap_Dialog_Insert_DateTime.h"
+
+class XAP_Win32Frame;
+
+class AP_Win32Dialog_Insert_DateTime : public AP_Dialog_Insert_DateTime
+{
+public:
+ AP_Win32Dialog_Insert_DateTime(XAP_DialogFactory * pDlgFactory,XAP_Dialog_Id id);
+
+ virtual void runModal(XAP_Frame * pFrame);
+
+ static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
+ static BOOL CALLBACK s_dlgProc(HWND,UINT,WPARAM,LPARAM);
+protected:
+ BOOL _onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam);
+ BOOL _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+private:
+ HWND m_hwndFormats;
+ void SetFormatsList(void);
+ void _FormatListBoxChange(void);
+};
+
+#endif /* AP_WIN32DIALOG_INSERT_DATETIME_H */
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/win/ap_Win32Res_DlgInsert_DateTime.rc2
src/wp/ap/win/ap_Win32Res_DlgInsert_DateTime.rc2
--- ..\abi.org\src\/wp/ap/win/ap_Win32Res_DlgInsert_DateTime.rc2 Thu Jan 01
03:00:00 1970
+++ src/wp/ap/win/ap_Win32Res_DlgInsert_DateTime.rc2 Wed Jan 05 18:53:31 2000
@@ -0,0 +1,56 @@
+// AbiWord
+// Copyright (C) 1998 AbiSource, Inc.
+//
+// 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.
+//////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////
+// THIS FILE IS INCLUDED BY .cpp AND .rc FILES.
+//
+// *** RC.exe IS BRAIN-DAMAGED. GIVING THIS FILE AN .rc2
+// *** EXTENSION MAKES #INCLUDING THIS FILE FROM Win32Main.rc
+// *** WORK -- IF THE SUFFIX IS .h ONLY THE #DEFINES WORK, THE
+// *** DIALOGS DO NOT GET COMPILED.
+//
+//////////////////////////////////////////////////////////////////
+
+#define AP_RID_DIALOG_INSERT_DATETIME_AVAILABALE_FORMATS 1001
+#define AP_RID_DIALOG_INSERT_DATETIME_FORMAT_LISTBOX 1002
+//#define AP_RID_DIALOG_INSERT_DATETIME_BTN_DEFAULT 1003
+#define AP_RID_DIALOG_INSERT_DATETIME_BTN_OK IDOK
+#define AP_RID_DIALOG_INSERT_DATETIME_BTN_CANCEL IDCANCEL
+
+#ifdef RC_INVOKED
+// NOTE -- these placeholder strings get overridden at runtime
+// NOTE -- they're just here to make sizing easier
+
+
+AP_RID_DIALOG_INSERT_DATETIME DIALOG DISCARDABLE 0, 0, 170, 143
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Date and Time"
+FONT 8, "MS Sans Serif"
+BEGIN
+ LISTBOX
+AP_RID_DIALOG_INSERT_DATETIME_FORMAT_LISTBOX,7,20,101,116,LBS_USETABSTOPS |
+ LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
+ WS_TABSTOP
+ DEFPUSHBUTTON "OK",AP_RID_DIALOG_INSERT_DATETIME_BTN_OK,113,7,50,14
+ PUSHBUTTON "Cancel",AP_RID_DIALOG_INSERT_DATETIME_BTN_CANCEL,113,24,50,14
+// PUSHBUTTON
+"Default...",AP_RID_DIALOG_INSERT_DATETIME_BTN_DEFAULT,113,41,50,14
+ LTEXT "Available
+Formats",AP_RID_DIALOG_INSERT_DATETIME_AVAILABALE_FORMATS,7,7,56,8
+END
+
+
+#endif /* RC_INVOKED */
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/win/ap_Win32Resources.rc2
src/wp/ap/win/ap_Win32Resources.rc2
--- ..\abi.org\src\/wp/ap/win/ap_Win32Resources.rc2 Wed Dec 29 19:16:12 1999
+++ src/wp/ap/win/ap_Win32Resources.rc2 Thu Jan 06 15:00:48 2000
@@ -38,11 +38,13 @@
#define AP_RID_DIALOG_OPT_SPL 208 //
tab-sub-dlg
#define AP_RID_DIALOG_OPT_PREF 209 //
tab-sub-dlg
#define AP_RID_DIALOG_OPT_VIEW 210 //
tab-sub-dlg
+#define AP_RID_DIALOG_INSERT_DATETIME 211
#include "ap_Win32Resources_DialogReplace.rc2"
#include "ap_Win32Res_DlgBreak.rc2"
#include "ap_Win32Res_DlgSpell.rc2"
#include "ap_Win32Res_DlgParagraph.rc2"
#include "ap_Win32Res_DlgOptions.rc2"
+#include "ap_Win32Res_DlgInsert_DateTime.rc2"
#include "ap_Win32Res_Icons.rc2"
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/xp/Makefile src/wp/ap/xp/Makefile
--- ..\abi.org\src\/wp/ap/xp/Makefile Wed Dec 29 19:17:07 1999
+++ src/wp/ap/xp/Makefile Wed Jan 05 18:19:09 2000
@@ -30,6 +30,7 @@
ap_Dialog_Paragraph.cpp \
ap_Dialog_Replace.cpp \
ap_Dialog_Spell.cpp \
+ ap_Dialog_Insert_DateTime.cpp \
ap_EditMethods.cpp \
ap_FrameData.cpp \
ap_LeftRuler.cpp \
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/xp/ap_Dialog_Id.h src/wp/ap/xp/ap_Dialog_Id.h
--- ..\abi.org\src\/wp/ap/xp/ap_Dialog_Id.h Wed Dec 29 19:17:20 1999
+++ src/wp/ap/xp/ap_Dialog_Id.h Thu Jan 06 14:33:01 2000
@@ -37,6 +37,7 @@
AP_DIALOG_ID_SPELL, /* spell check */
AP_DIALOG_ID_PARAGRAPH, /* paragraph settings dialog */
AP_DIALOG_ID_OPTIONS, /* edit|options settings
dialog */
+ AP_DIALOG_ID_INSERT_DATETIME, /* insert date and time dialog */
/* ... add others here ... */
AP_DIALOG_ID__LAST__ /* must be last */
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/xp/ap_Dialog_Insert_DateTime.cpp
src/wp/ap/xp/ap_Dialog_Insert_DateTime.cpp
--- ..\abi.org\src\/wp/ap/xp/ap_Dialog_Insert_DateTime.cpp Thu Jan 01 03:00:00
1970
+++ src/wp/ap/xp/ap_Dialog_Insert_DateTime.cpp Sat Jan 15 12:34:58 2000
@@ -0,0 +1,47 @@
+/* AbiWord
+ * Copyright (C) 1998 AbiSource, Inc.
+ *
+ * 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "ut_assert.h"
+#include "ut_string.h"
+#include "ut_debugmsg.h"
+
+#include "xap_Dialog_Id.h"
+#include "xap_DialogFactory.h"
+#include "xap_Dlg_MessageBox.h"
+
+#include "ap_Dialog_Insert_DateTime.h"
+
+AP_Dialog_Insert_DateTime::AP_Dialog_Insert_DateTime(XAP_DialogFactory * pDlgFactory,
+XAP_Dialog_Id id)
+ : XAP_Dialog_NonPersistent(pDlgFactory,id)
+{
+ m_answer = a_OK;
+}
+
+AP_Dialog_Insert_DateTime::tAnswer AP_Dialog_Insert_DateTime::getAnswer(void) const
+{
+ return m_answer;
+}
+
+const char *AP_Dialog_Insert_DateTime::GetDateTimeFormat(void) const
+{
+ return (const char *)InsertDateTimeFmts[m_iFormatIndex];
+}
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/xp/ap_Dialog_Insert_DateTime.h
src/wp/ap/xp/ap_Dialog_Insert_DateTime.h
--- ..\abi.org\src\/wp/ap/xp/ap_Dialog_Insert_DateTime.h Thu Jan 01 03:00:00
1970
+++ src/wp/ap/xp/ap_Dialog_Insert_DateTime.h Sat Jan 15 12:35:18 2000
@@ -0,0 +1,70 @@
+/* AbiWord
+ * Copyright (C) 1998 AbiSource, Inc.
+ *
+ * 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.
+ */
+
+#ifndef AP_DIALOG_INSERT_DATETIME_H
+#define AP_DIALOG_INSERT_DATETIME_H
+
+#include "xap_Frame.h"
+#include "xap_Dialog.h"
+#include "xav_View.h"
+
+/*
+M/d/yy
+dddd, MMMM dd, yyyy
+MMMM d, yyyy
+M/d/yyyy
+yyyy-MM-dd
+d-MMM-yy
+M.d.yy
+MMM. d, yy
+d MMMM, yyyy
+MMMM, yyyy
+MMM-yy
+M/d/yy h:mm
+M/d/yy h:mm:ss
+h:mm
+h:mm:ss
+HH:mm
+HH:mm:ss
+*/
+
+#define CURRENT_DATE_TIME_SIZE 256
+
+static const char *InsertDateTimeFmts[] = {
+ "%m/%d/%y","%A, %B %d, %Y","%B %d, %Y","%m/%d/%Y","%Y-%m-%d","%d-%b-%y",
+ "%m.%d.%y","%b. %d, %y","%d %B, %Y","%B, %Y","%b-%y","%m/%d/%y %H:%M",
+ "%m/%d/%y %H:%M:%S","%H:%M","%H:%M:%S",NULL
+};
+
+class XAP_Frame;
+
+class AP_Dialog_Insert_DateTime : public XAP_Dialog_NonPersistent
+{
+public:
+ typedef enum { a_OK, a_CANCEL } tAnswer;
+
+ AP_Dialog_Insert_DateTime(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
+ AP_Dialog_Insert_DateTime::tAnswer getAnswer(void) const;
+ const char *GetDateTimeFormat(void) const;
+protected:
+ AP_Dialog_Insert_DateTime::tAnswer m_answer;
+ int m_iFormatIndex;
+};
+
+#endif /* AP_DIALOG_INSERT_DATETIME_H */
diff -urNwb -x CVS -x WIN32_4.0_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x
patch.txt -x .#*.* ..\abi.org\src\/wp/ap/xp/ap_EditMethods.cpp
src/wp/ap/xp/ap_EditMethods.cpp
--- ..\abi.org\src\/wp/ap/xp/ap_EditMethods.cpp Fri Jan 14 21:17:17 2000
+++ src/wp/ap/xp/ap_EditMethods.cpp Sat Jan 15 12:28:16 2000
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "ut_debugmsg.h"
#include "ut_string.h"
#include "ut_bytebuf.h"
@@ -47,6 +48,7 @@
#include "ap_Dialog_Paragraph.h"
#include "ap_Dialog_Options.h"
#include "ap_Dialog_Spell.h"
+#include "ap_Dialog_Insert_DateTime.h"
#include "xap_DialogFactory.h"
#include "xap_Dlg_About.h"
@@ -3786,6 +3788,45 @@
return s_doZoomDlg(pView);
}
+static UT_Bool s_doInsertDateTime(FV_View * pView)
+{
+ XAP_Frame * pFrame = (XAP_Frame *) pView->getParentData();
+ UT_ASSERT(pFrame);
+
+ pFrame->raise();
+
+ XAP_DialogFactory * pDialogFactory
+ = (XAP_DialogFactory *)(pFrame->getDialogFactory());
+
+ AP_Dialog_Insert_DateTime * pDialog
+ = (AP_Dialog_Insert_DateTime
+*)(pDialogFactory->requestDialog(AP_DIALOG_ID_INSERT_DATETIME));
+ UT_ASSERT(pDialog);
+
+ pDialog->runModal(pFrame);
+
+ if (pDialog->getAnswer() == AP_Dialog_Insert_DateTime::a_OK)
+ {
+ time_t tim = time(NULL);
+ struct tm *pTime = localtime(&tim);
+ UT_UCSChar *CurrentDateTime = NULL;
+ char szCurrentDateTime[CURRENT_DATE_TIME_SIZE];
+
+
+strftime(szCurrentDateTime,CURRENT_DATE_TIME_SIZE,pDialog->GetDateTimeFormat(),pTime);
+ UT_UCS_cloneString_char(&CurrentDateTime,szCurrentDateTime);
+ pView->cmdCharInsert(CurrentDateTime,UT_UCS_strlen(CurrentDateTime));
+ FREEP(CurrentDateTime);
+ }
+
+ pDialogFactory->releaseDialog(pDialog);
+
+ return UT_TRUE;
+}
+
+Defun1(insDateTime)
+{
+ ABIWORD_VIEW;
+ return s_doInsertDateTime(pView);
+}
/*****************************************************************/
/*****************************************************************/
@@ -3805,15 +3846,6 @@
return UT_TRUE;
}
-Defun1(insDateTime)
-{
- XAP_Frame * pFrame = (XAP_Frame *) pAV_View->getParentData();
- UT_ASSERT(pFrame);
-
- s_TellNotImplemented(pFrame, "Insert date/time dialog", __LINE__);
- return UT_TRUE;
-}
-
Defun1(insField)
{
XAP_Frame * pFrame = (XAP_Frame *) pAV_View->getParentData();