? abi/shots/wp/unix/insert_symbol.png ? abi/src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp ? abi/src/af/xap/unix/xap_UnixDlg_Insert_Symbol.h ? abi/src/af/xap/win/xap_Win32_Insert_Symbol.h ? abi/src/af/xap/win/xap_Win32_Insert_Symbol.cpp ? abi/src/af/xap/xp/xap_Dlg_Insert_Symbol.h ? abi/src/af/xap/xp/xap_Draw_Symbol.cpp ? abi/src/af/xap/xp/xap_Draw_Symbol.h ? abi/src/af/xap/xp/xap_Dlg_Insert_Symbol.cpp Index: abi/src/af/xap/Makefile =================================================================== RCS file: /cvsroot/abi/src/af/xap/Makefile,v retrieving revision 1.38 diff -u -r1.38 Makefile --- abi/src/af/xap/Makefile 2000/02/08 01:23:17 1.38 +++ abi/src/af/xap/Makefile 2000/02/29 02:47:27 @@ -36,6 +36,7 @@ $(OBJDIR)/xap_$(ABI_FE)Dlg_Print.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_$(ABI_FE)Dlg_WindowMore.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_$(ABI_FE)Dlg_Zoom.$(OBJ_SUFFIX) \ + $(OBJDIR)/xap_$(ABI_FE)Dlg_Insert_Symbol.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_$(ABI_FE)Frame.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_$(ABI_FE)Toolbar_Icons.$(OBJ_SUFFIX) @@ -83,12 +84,14 @@ $(OBJDIR)/xap_Dlg_Print.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Dlg_WindowMore.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Dlg_Zoom.$(OBJ_SUFFIX) \ + $(OBJDIR)/xap_Dlg_Insert_Symbol.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_FakeClipboard.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Frame.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_LoadBindings.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Prefs.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Preview.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Preview_Zoom.$(OBJ_SUFFIX) \ + $(OBJDIR)/xap_Draw_Symbol.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Scrollbar_ViewListener.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Strings.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Toolbar_ControlFactory.$(OBJ_SUFFIX) \ Index: abi/src/af/xap/unix/Makefile =================================================================== RCS file: /cvsroot/abi/src/af/xap/unix/Makefile,v retrieving revision 1.29 diff -u -r1.29 Makefile --- abi/src/af/xap/unix/Makefile 1999/12/12 15:07:08 1.29 +++ abi/src/af/xap/unix/Makefile 2000/02/29 02:47:27 @@ -35,6 +35,7 @@ xap_UnixDlg_Print.cpp \ xap_UnixDlg_WindowMore.cpp \ xap_UnixDlg_Zoom.cpp \ + xap_UnixDlg_Insert_Symbol.cpp \ xap_UnixFontXLFD.cpp \ xap_UnixFont.cpp \ xap_UnixFontManager.cpp \ Index: abi/src/af/xap/xp/Makefile =================================================================== RCS file: /cvsroot/abi/src/af/xap/xp/Makefile,v retrieving revision 1.23 diff -u -r1.23 Makefile --- abi/src/af/xap/xp/Makefile 1999/10/18 14:00:57 1.23 +++ abi/src/af/xap/xp/Makefile 2000/02/29 02:47:28 @@ -36,12 +36,14 @@ xap_Dlg_Print.cpp \ xap_Dlg_WindowMore.cpp \ xap_Dlg_Zoom.cpp \ + xap_Dlg_Insert_Symbol.cpp \ xap_FakeClipboard.cpp \ xap_Frame.cpp \ xap_LoadBindings.cpp \ xap_Prefs.cpp \ xap_Preview.cpp \ xap_Preview_Zoom.cpp \ + xap_Draw_Symbol.cpp \ xap_Scrollbar_ViewListener.cpp \ xap_Strings.cpp \ xap_Toolbar_ControlFactory.cpp \ Index: abi/src/af/xap/xp/xap_DialogFactory.cpp =================================================================== RCS file: /cvsroot/abi/src/af/xap/xp/xap_DialogFactory.cpp,v retrieving revision 1.9 diff -u -r1.9 xap_DialogFactory.cpp --- abi/src/af/xap/xp/xap_DialogFactory.cpp 1999/05/01 08:45:48 1.9 +++ abi/src/af/xap/xp/xap_DialogFactory.cpp 2000/02/29 02:47:28 @@ -17,6 +17,7 @@ * 02111-1307, USA. */ +#include "ut_debugmsg.h" #include "ut_types.h" #include "ut_vector.h" #include "xap_App.h" @@ -70,7 +71,7 @@ return UT_TRUE; } } - + UT_DEBUGMSG(("SEVIOR: Could not find a match for id %d \n",id)); UT_ASSERT(UT_NOT_IMPLEMENTED); return UT_FALSE; } Index: abi/src/af/xap/xp/xap_Dialog_Id.h =================================================================== RCS file: /cvsroot/abi/src/af/xap/xp/xap_Dialog_Id.h,v retrieving revision 1.10 diff -u -r1.10 xap_Dialog_Id.h --- abi/src/af/xap/xp/xap_Dialog_Id.h 1999/05/01 08:45:48 1.10 +++ abi/src/af/xap/xp/xap_Dialog_Id.h 2000/02/29 02:47:28 @@ -45,7 +45,7 @@ XAP_DIALOG_ID_ZOOM, XAP_DIALOG_ID_ABOUT, /* about dialog */ - + XAP_DIALOG_ID_INSERT_SYMBOL, /* ... add others here ... */ XAP_DIALOG_ID__LAST__ = 1000 /* must be last */ Index: abi/src/text/fmt/xp/fv_View.cpp =================================================================== RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.cpp,v retrieving revision 1.242 diff -u -r1.242 fv_View.cpp --- abi/src/text/fmt/xp/fv_View.cpp 2000/02/10 21:32:08 1.242 +++ abi/src/text/fmt/xp/fv_View.cpp 2000/02/29 02:47:35 @@ -1791,6 +1791,8 @@ void FV_View::cmdCharDelete(UT_Bool bForward, UT_uint32 count) { + UT_DEBUGMSG(("SEVIOR: selection, bforward, count = %d %d, %d \n", + isSelectionEmpty(),bForward,count)); if (!isSelectionEmpty()) { _deleteSelection(); @@ -2876,6 +2878,36 @@ UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return UT_FALSE; +} + +void FV_View::InsertSymbol(UT_UCSChar c, XML_Char * symfont, XML_Char * currentfont) + /* Move code here to use _generalUpdate */ + +{ + if(strstr(symfont,currentfont) == NULL) + { + /* Now set the font */ + + const XML_Char * properties[] = { "font-family", NULL, 0}; + properties[1] = symfont ; + setCharFormat(properties); + + /* Now insert the character */ + + cmdCharInsert(&c,1); + + /* Now change the font back to its original value */ + + properties[1] = currentfont; + setCharFormat(properties); + _generalUpdate(); + } + else + { + /* Just insert the character */ + + cmdCharInsert(&c,1); + } } /* Index: abi/src/text/fmt/xp/fv_View.h =================================================================== RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.h,v retrieving revision 1.108 diff -u -r1.108 fv_View.h --- abi/src/text/fmt/xp/fv_View.h 2000/02/10 21:32:08 1.108 +++ abi/src/text/fmt/xp/fv_View.h 2000/02/29 02:47:35 @@ -156,7 +156,7 @@ void insertParagraphBreak(void); void insertSectionBreak(void); - + void InsertSymbol(UT_UCSChar c, XML_Char * symfont, XML_Char * currentfont); // ---------------------- UT_Bool isLeftMargin(UT_sint32 xPos, UT_sint32 yPos); void cmdSelect(UT_sint32 xPos, UT_sint32 yPos, FV_DocPos dpBeg, FV_DocPos dpEnd); Index: abi/src/wp/ap/unix/ap_UnixDialog_All.h =================================================================== RCS file: /cvsroot/abi/src/wp/ap/unix/ap_UnixDialog_All.h,v retrieving revision 1.23 diff -u -r1.23 ap_UnixDialog_All.h --- abi/src/wp/ap/unix/ap_UnixDialog_All.h 2000/02/08 01:23:18 1.23 +++ abi/src/wp/ap/unix/ap_UnixDialog_All.h 2000/02/29 02:47:36 @@ -41,6 +41,7 @@ # include "xap_UnixDlg_FontChooser.h" # include "xap_UnixDlg_About.h" # include "xap_UnixDlg_Zoom.h" +# include "xap_UnixDlg_Insert_Symbol.h" # include "ap_UnixDialog_Replace.h" # include "ap_UnixDialog_Break.h" @@ -89,6 +90,8 @@ DeclareDialog(XAP_DIALOG_ID_FONT, XAP_UnixDialog_FontChooser) DeclareDialog(XAP_DIALOG_ID_WINDOWMORE, XAP_UnixDialog_WindowMore) DeclareDialog(XAP_DIALOG_ID_ZOOM, XAP_UnixDialog_Zoom) + DeclareDialog(XAP_DIALOG_ID_INSERT_SYMBOL, XAP_UnixDialog_Insert_Symbol) + DeclareDialog(XAP_DIALOG_ID_ABOUT, XAP_UnixDialog_About) DeclareDialog(AP_DIALOG_ID_REPLACE, AP_UnixDialog_Replace) Index: abi/src/wp/ap/xp/ap_Dialog_Id.h =================================================================== RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Dialog_Id.h,v retrieving revision 1.14 diff -u -r1.14 ap_Dialog_Id.h --- abi/src/wp/ap/xp/ap_Dialog_Id.h 2000/02/10 21:36:10 1.14 +++ abi/src/wp/ap/xp/ap_Dialog_Id.h 2000/02/29 02:47:37 @@ -39,6 +39,7 @@ AP_DIALOG_ID_OPTIONS, /* edit|options settings dialog */ AP_DIALOG_ID_INSERT_DATETIME, /* insert date and time dialog */ AP_DIALOG_ID_FIELD, /* insert field dialog */ + AP_DIALOG_ID_INSERT_SYMBOL, /* insert symbol dialog */ /* ... add others here ... */ AP_DIALOG_ID__LAST__ /* must be last */ Index: abi/src/wp/ap/xp/ap_EditMethods.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/ap/xp/ap_EditMethods.cpp,v retrieving revision 1.181 diff -u -r1.181 ap_EditMethods.cpp --- abi/src/wp/ap/xp/ap_EditMethods.cpp 2000/02/17 18:38:07 1.181 +++ abi/src/wp/ap/xp/ap_EditMethods.cpp 2000/02/29 02:47:41 @@ -59,6 +59,7 @@ #include "xap_Dlg_Print.h" #include "xap_Dlg_WindowMore.h" #include "xap_Dlg_Zoom.h" +#include "xap_Dlg_Insert_Symbol.h" #include "ie_imp.h" #include "ie_impGraphic.h" @@ -3782,6 +3783,71 @@ return bOK; } + + +static UT_Bool s_InsertSymbolDlg(FV_View * pView, XAP_Dialog_Id id ) +{ + XAP_Frame * pFrame = (XAP_Frame *) pView->getParentData(); + UT_ASSERT(pFrame); + + pFrame->raise(); + + XAP_DialogFactory * pDialogFactory + = (XAP_DialogFactory *)(pFrame->getDialogFactory()); + + XAP_Dialog_Insert_Symbol * pDialog + = (XAP_Dialog_Insert_Symbol *)(pDialogFactory->requestDialog(id)); + UT_ASSERT(pDialog); + + pDialog->runModal(pFrame); + + /* + +If the of the symbol font is the current font, don't change it, just insert +the symbol. + +If the font isn't the current font, change the font to new one, insert the +symbol and change it back to the previous font. + + */ + + XAP_Dialog_Insert_Symbol::tAnswer ans = pDialog->getAnswer(); + + if(ans == XAP_Dialog_Insert_Symbol::a_OK) + { + + /* User pressed OK so first determine the current font and save it*/ + + /* Code stolen from _togglespan */ + + const XML_Char ** props_in = NULL; + const XML_Char * currentfont; + pView->getCharFormat(&props_in); + currentfont = UT_getAttribute("font-family",props_in); + + /* Now get the character to be inserted */ + + UT_UCSChar c = pDialog->getInsertedSymbol(); + + /* Now get the font of the symbol to be inserted */ + + XML_Char * symfont = (XML_Char *) pDialog->getInsertedFont(); + + /* Check to see if the current font is the same as the symbol */ + + /* Have moved all the insertion code to fv_View to be able to + use _generalUpadte + */ + + pView->InsertSymbol((UT_UCSChar) c, (XML_Char *) symfont, + (XML_Char *) currentfont); + free(props_in); + } + pDialogFactory->releaseDialog(pDialog); + + return UT_TRUE; +} + /*****************************************************************/ /*****************************************************************/ @@ -4023,11 +4089,18 @@ Defun1(insSymbol) { + + ABIWORD_VIEW; + XAP_Dialog_Id id = XAP_DIALOG_ID_INSERT_SYMBOL; + + return s_InsertSymbolDlg(pView,id); + /* +OLD CODE XAP_Frame * pFrame = (XAP_Frame *) pAV_View->getParentData(); UT_ASSERT(pFrame); - s_TellNotImplemented(pFrame, "Insert symbol dialog", __LINE__); return UT_TRUE; + */ }