diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/af/xap/xp/xap_App.cpp abi.ins\src\/af/xap/xp/xap_App.cpp --- abi.org\src\/af/xap/xp/xap_App.cpp Sat Jan 22 17:54:21 2000 +++ abi.ins\src\/af/xap/xp/xap_App.cpp Fri Feb 25 17:36:50 2000 @@ -27,6 +27,8 @@ #include "ev_Menu_Actions.h" #include "ev_Toolbar_Actions.h" #include "xap_App.h" +#include "xav_View.h" +#include "xav_Listener.h" #include "xap_Args.h" #include "gr_Image.h" #include "xap_Frame.h" @@ -52,6 +54,7 @@ m_pToolbarActionSet = NULL; m_pDict = NULL; m_prefs = NULL; + m_bInsertState = UT_TRUE; } XAP_App::~XAP_App(void) @@ -438,3 +441,27 @@ return m_prefs->getPrefsValueBool(szKey,pbValue); } +void XAP_App::notifyFramesListeners(const AV_ChangeMask Mask) +{ + UT_uint32 i; + for(i = 0;i < getFrameCount();i++){ + XAP_Frame * pFrame = getFrame(i); + UT_ASSERT(pFrame); + AV_View * pView = pFrame->getCurrentView(); + UT_ASSERT(pView); + pView->notifyListeners(Mask); + } +} + +void XAP_App::setInsertState(UT_Bool bInsertState) +{ + if(m_bInsertState != bInsertState){ + m_bInsertState = bInsertState; + notifyFramesListeners(AV_CHG_INSERTSTATE); + } +} + +UT_Bool XAP_App::getInsertState(void) const +{ + return m_bInsertState; +} diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/af/xap/xp/xap_App.h abi.ins\src\/af/xap/xp/xap_App.h --- abi.org\src\/af/xap/xp/xap_App.h Sat Jan 22 17:54:22 2000 +++ abi.ins\src\/af/xap/xp/xap_App.h Fri Feb 25 17:35:50 2000 @@ -106,7 +106,9 @@ virtual void pasteFromClipboard(PD_DocumentRange * pDocRange, UT_Bool bUseClipboard) = 0; virtual UT_Bool canPasteFromClipboard(void) = 0; virtual void cacheCurrentSelection(AV_View *) = 0; - + void notifyFramesListeners(const AV_ChangeMask Mask); + void setInsertState(UT_Bool bInsertState); + UT_Bool getInsertState(void) const; protected: void _setAbiSuiteLibDir(const char * sz); @@ -124,6 +126,7 @@ UT_Vector m_vecFrames; UT_HashTable m_hashClones; + UT_Bool m_bInsertState; }; #endif /* XAP_APP_H */ diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/af/xap/xp/xav_Listener.h abi.ins\src\/af/xap/xp/xav_Listener.h --- abi.org\src\/af/xap/xp/xav_Listener.h Sat Jan 22 17:54:40 2000 +++ abi.ins\src\/af/xap/xp/xav_Listener.h Fri Feb 25 13:35:05 2000 @@ -42,6 +42,7 @@ #define AV_CHG_COLUMN ((AV_ChangeMask) 0x0400) #define AV_CHG_INPUTMODE ((AV_ChangeMask) 0x0800) #define AV_CHG_FMTSTYLE ((AV_ChangeMask) 0x1000) // getStyle +#define AV_CHG_INSERTSTATE ((AV_ChangeMask) 0x2000) #define AV_CHG_ALL ((AV_ChangeMask) 0xFFFF) #define AV_CHG_SAVE ((AV_ChangeMask) (AV_CHG_DO | AV_CHG_DIRTY | AV_CHG_FILENAME)) diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/text/fmt/xp/fv_View.cpp abi.ins\src\/text/fmt/xp/fv_View.cpp --- abi.org\src\/text/fmt/xp/fv_View.cpp Tue Feb 01 13:45:10 2000 +++ abi.ins\src\/text/fmt/xp/fv_View.cpp Fri Feb 25 19:27:18 2000 @@ -888,21 +888,25 @@ return m_pLayout->findBlockAtPosition(pos); } -UT_Bool FV_View::cmdCharInsert(UT_UCSChar * text, UT_uint32 count) +UT_Bool FV_View::_cmdCharInsert(UT_UCSChar * text, UT_uint32 count, UT_Bool bInsertState) { UT_Bool bResult; - if (!isSelectionEmpty()) - { + if(!isSelectionEmpty()){ m_pDoc->beginUserAtomicGlob(); _deleteSelection(); bResult = m_pDoc->insertSpan(getPoint(), text, count); m_pDoc->endUserAtomicGlob(); - } - else - { + } else { _eraseInsertionPoint(); + m_pDoc->beginUserAtomicGlob(); + + if (!bInsertState){ + cmdCharDelete(UT_TRUE,count); + } + bResult = m_pDoc->insertSpan(getPoint(), text, count); + m_pDoc->endUserAtomicGlob(); } _generalUpdate(); @@ -916,6 +920,23 @@ return bResult; } +UT_Bool FV_View::cmdCharInsert(UT_UCSChar * text, UT_uint32 count) +{ + return _cmdCharInsert(text,count,m_pApp->getInsertState()); +} + +UT_Bool FV_View::cmdCharInsert(UT_UCSChar * text, UT_uint32 count, UT_Bool bForce) +{ + UT_Bool bInsertState; + if(bForce){ + bInsertState = UT_TRUE; + } else { + bInsertState = m_pApp->getInsertState(); + } + return _cmdCharInsert(text,count,bInsertState); +} + + void FV_View::insertSectionBreak(void) { m_pDoc->beginUserAtomicGlob(); diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/text/fmt/xp/fv_View.h abi.ins\src\/text/fmt/xp/fv_View.h --- abi.org\src\/text/fmt/xp/fv_View.h Tue Feb 01 13:45:22 2000 +++ abi.ins\src\/text/fmt/xp/fv_View.h Fri Feb 25 18:10:52 2000 @@ -161,6 +161,7 @@ void cmdSelect(UT_sint32 xPos, UT_sint32 yPos, FV_DocPos dpBeg, FV_DocPos dpEnd); void cmdCharMotion(UT_Bool bForward, UT_uint32 count); UT_Bool cmdCharInsert(UT_UCSChar * text, UT_uint32 count); + UT_Bool cmdCharInsert(UT_UCSChar * text, UT_uint32 count, UT_Bool bForce); void cmdCharDelete(UT_Bool bForward, UT_uint32 count); void delTo(FV_DocPos dp); UT_UCSChar * getSelectionText(void); @@ -340,6 +341,8 @@ // prefs listener - to change cursor blink on/off (and possibly others) static void _prefsListener( XAP_App *, XAP_Prefs *, UT_AlphaHashTable *, void *); + + UT_Bool _cmdCharInsert(UT_UCSChar * text, UT_uint32 count, UT_Bool bInsertState); }; #endif /* FV_VIEW_H */ diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/wp/ap/win/ap_Win32App.cpp abi.ins\src\/wp/ap/win/ap_Win32App.cpp --- abi.org\src\/wp/ap/win/ap_Win32App.cpp Fri Jan 28 09:10:58 2000 +++ abi.ins\src\/wp/ap/win/ap_Win32App.cpp Fri Feb 25 20:27:25 2000 @@ -602,7 +602,7 @@ UT_PNG_getDimensions(pBB, iSplashWidth, iSplashHeight); // create a centered window the size of our bitmap - hwndSplash = CreateWindow(s_SplashWndClassName, + hwndSplash = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST,s_SplashWndClassName, NULL, WS_POPUP | WS_BORDER, (rect.right / 2) - (iSplashWidth / 2), (rect.bottom / 2) - (iSplashHeight / 2), @@ -619,7 +619,6 @@ DELETEP(pG); // now bring the window up front & center - SetWindowPos(hwndSplash, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); ShowWindow(hwndSplash, SW_SHOWNORMAL); UpdateWindow(hwndSplash); } diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/wp/ap/xp/ap_EditMethods.cpp abi.ins\src\/wp/ap/xp/ap_EditMethods.cpp --- abi.org\src\/wp/ap/xp/ap_EditMethods.cpp Tue Feb 01 13:51:55 2000 +++ abi.ins\src\/wp/ap/xp/ap_EditMethods.cpp Fri Feb 25 19:28:18 2000 @@ -314,6 +314,7 @@ static EV_EditMethod_Fn setEditVI; static EV_EditMethod_Fn setInputVI; static EV_EditMethod_Fn cycleInputMode; + static EV_EditMethod_Fn cycleInsertState; static EV_EditMethod_Fn viCmd_A; static EV_EditMethod_Fn viCmd_I; @@ -591,6 +592,7 @@ EV_EditMethod(NF(setEditVI), 0, ""), EV_EditMethod(NF(setInputVI), 0, ""), EV_EditMethod(NF(cycleInputMode), 0, ""), + EV_EditMethod(NF(cycleInsertState), 0, ""), EV_EditMethod(NF(viCmd_A), 0, ""), EV_EditMethod(NF(viCmd_I), 0, ""), @@ -3932,7 +3934,7 @@ strftime(szCurrentDateTime,CURRENT_DATE_TIME_SIZE,pDialog->GetDateTimeFormat(),pTime); UT_UCS_cloneString_char(&CurrentDateTime,szCurrentDateTime); - pView->cmdCharInsert(CurrentDateTime,UT_UCS_strlen(CurrentDateTime)); + pView->cmdCharInsert(CurrentDateTime,UT_UCS_strlen(CurrentDateTime),UT_TRUE); FREEP(CurrentDateTime); } @@ -4252,6 +4254,18 @@ return bResult; } +Defun1(cycleInsertState) +{ + XAP_Frame * pFrame = (XAP_Frame *) pAV_View->getParentData(); + UT_ASSERT(pFrame); + XAP_App * pApp = pFrame->getApp(); + UT_ASSERT(pApp); + + pApp->setInsertState(!pApp->getInsertState()); + return UT_TRUE; +} + + ////////////////////////////////////////////////////////////////// // The following commands are suggested for the various VI keybindings. // It may be possible to use our exisiting methods for them, but I diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/wp/ap/xp/ap_LB_Default.cpp abi.ins\src\/wp/ap/xp/ap_LB_Default.cpp --- abi.org\src\/wp/ap/xp/ap_LB_Default.cpp Tue Feb 01 13:53:27 2000 +++ abi.ins\src\/wp/ap/xp/ap_LB_Default.cpp Fri Feb 25 13:41:20 2000 @@ -178,7 +178,7 @@ "", "", "", "" }}, {EV_NVK_MENU_SHORTCUT, { "contextMenu", "", "", "", "", "", "", "" }}, - {EV_NVK_INSERT, { "", "paste", "copy", "", + {EV_NVK_INSERT, { "cycleInsertState", "paste", "copy", "", "", "", "", "" }}, {EV_NVK_DELETE, { "delRight", "cut", "delEOW", "", "", "", "", "" }}, diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/wp/ap/xp/ap_StatusBar.cpp abi.ins\src\/wp/ap/xp/ap_StatusBar.cpp --- abi.org\src\/wp/ap/xp/ap_StatusBar.cpp Sat Jan 22 18:00:09 2000 +++ abi.ins\src\/wp/ap/xp/ap_StatusBar.cpp Fri Feb 25 13:57:42 2000 @@ -355,6 +355,88 @@ } } +class ap_sb_Field_InsertState : public ap_sb_Field +{ +public: + ap_sb_Field_InsertState(AP_StatusBar * pSB); + virtual ~ap_sb_Field_InsertState(void); + + virtual UT_uint32 getDesiredWidth(void); + virtual void draw(void); + virtual void notify(AV_View * pView, const AV_ChangeMask mask); + +private: + UT_UCSChar m_InsertState[2][AP_MAX_MESSAGE_FIELD]; + UT_Bool m_bInsertState; + UT_uint32 m_iDesiredWidth; +}; + +ap_sb_Field_InsertState::ap_sb_Field_InsertState(AP_StatusBar * pSB) + : ap_sb_Field(pSB) +{ + UT_UCS_strcpy_char(m_InsertState[(int)UT_TRUE],pSB->getFrame()->getApp()->getStringSet()->getValue(AP_STRING_ID_InsertStateFieldINS)); + UT_UCS_strcpy_char(m_InsertState[(int)UT_FALSE],pSB->getFrame()->getApp()->getStringSet()->getValue(AP_STRING_ID_InsertStateFieldOVR)); + + m_iDesiredWidth = 0; + m_bInsertState = UT_TRUE; +} + +ap_sb_Field_InsertState::~ap_sb_Field_InsertState(void) +{ +} + +UT_uint32 ap_sb_Field_InsertState::getDesiredWidth(void) +{ + if (!m_iDesiredWidth) + { + UT_uint32 i; + UT_uint16 charWidths[AP_MAX_MESSAGE_FIELD]; + UT_uint32 len; + for(i = 0;i < 2;i++){ + len = UT_UCS_strlen(m_InsertState[i]); + m_iDesiredWidth = MyMax(m_iDesiredWidth,m_pSB->getGraphics()->measureString(m_InsertState[i],0,len,charWidths)); + } + UT_ASSERT(m_iDesiredWidth); + m_iDesiredWidth = MyMin(m_iDesiredWidth,300) + 6; + } + return m_iDesiredWidth; +} + +void ap_sb_Field_InsertState::draw(void) +{ + _draw3D(); + int len; + + UT_UCSChar *bufInsertState = m_InsertState[m_bInsertState]; + + len = UT_UCS_strlen(bufInsertState); + + if (len) + { + GR_Graphics * pG = m_pSB->getGraphics(); + UT_uint32 iFontHeight = pG->getFontHeight(); + + UT_uint32 x = m_rect3d.left + 3; + UT_uint32 y = m_rect3d.top + (m_rect3d.height-iFontHeight)/2; + + pG->setColor3D(GR_Graphics::CLR3D_Foreground); + + pG->setClipRect(&m_rect3d); + pG->drawChars(bufInsertState,0,len,x,y); + pG->setClipRect(NULL); + } +} + +void ap_sb_Field_InsertState::notify(AV_View * pavView, const AV_ChangeMask mask) +{ + if (mask & (AV_CHG_INSERTSTATE)) + { + UT_ASSERT(pavView); + m_bInsertState = pavView->getApp()->getInsertState(); + draw(); + } +} + ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// @@ -428,6 +510,7 @@ m_pStatusMessageField = pf2; // its in the vector, but we remember it explicitly // so that setStatusMessage() can do its thing. + DclField(ap_sb_Field_InsertState, pf4); DclField(ap_sb_Field_InputMode, pf3); // TODO add other fields diff -urNwb -x CVS -x WIN32_20.1_i386_DBG -x WIN32_20.1_i386_OBJ -x abidiff.cmd -x patch.txt -x .#*.* abi.org\src\/wp/ap/xp/ap_String_Id.h abi.ins\src\/wp/ap/xp/ap_String_Id.h --- abi.org\src\/wp/ap/xp/ap_String_Id.h Sat Jan 29 09:10:08 2000 +++ abi.ins\src\/wp/ap/xp/ap_String_Id.h Fri Feb 25 13:52:42 2000 @@ -46,6 +46,9 @@ // Status Bar Messages dcl(PageInfoField, "Page: %d/%d") +dcl(InsertStateFieldINS, "INS") +dcl(InsertStateFieldOVR, "OVR") + /* Find and Replace strings */ dcl(DLG_FR_FindTitle, "Find") dcl(DLG_FR_ReplaceTitle, "Replace")