Index: src/wp/ap/unix/ap_UnixDialog_Spell.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/ap/unix/ap_UnixDialog_Spell.cpp,v retrieving revision 1.18 diff -u -u -r1.18 ap_UnixDialog_Spell.cpp --- src/wp/ap/unix/ap_UnixDialog_Spell.cpp 2001/02/06 22:54:51 1.18 +++ src/wp/ap/unix/ap_UnixDialog_Spell.cpp 2001/03/06 08:22:15 @@ -58,25 +58,26 @@ void AP_UnixDialog_Spell::runModal(XAP_Frame * pFrame) { UT_DEBUGMSG(("beginning spelling check...\n")); - + // class the base class method to initialize some basic xp stuff AP_Dialog_Spell::runModal(pFrame); - + m_bCancelled = false; + m_bIgnoreAll = false; bool bRes = nextMisspelledWord(); - + if (bRes) { // we need to prepare the dialog GtkWidget * mainWindow = _constructWindow(); UT_ASSERT(mainWindow); - + connectFocus(GTK_WIDGET(mainWindow),pFrame); // Populate the window's data items _populateWindowData(); - + // To center the dialog, we need the frame of its parent. XAP_UnixFrame * pUnixFrame = static_cast(pFrame); UT_ASSERT(pUnixFrame); - + // Get the GtkWindow of the parent frame GtkWidget * parentWindow = pUnixFrame->getTopLevelWindow(); UT_ASSERT(parentWindow); @@ -84,39 +85,48 @@ // Center our new dialog in its parent and make it a transient // so it won't get lost underneath centerDialog(parentWindow, mainWindow); - + // Show the top level dialog gtk_widget_show_all(mainWindow); // Make it modal, and stick it up top gtk_grab_add(mainWindow); - + // now loop while there are still misspelled words while (bRes) { - + // show word in main window makeWordVisible(); - + // update dialog with new misspelled word info/suggestions _showMisspelledWord(); - + // run into the GTK event loop for this window gtk_main(); - + _purgeSuggestions(); - + if (m_bCancelled) break; - - // get the next unknown word + //A hack to fix IgnoreAll button functionality: any advice on + //making it cleaner? + if (m_bIgnoreAll) { + bRes = nextMisspelledWord(); + while (bRes) { + addIgnoreAll(); + ignoreWord(); + bRes = nextMisspelledWord(); + } + } + else // get the next unknown word bRes = nextMisspelledWord(); } - + _storeWindowData(); - + if(mainWindow && GTK_IS_WIDGET(mainWindow)) gtk_widget_destroy(mainWindow); } - + // TODO: all done message? UT_DEBUGMSG(("spelling check complete.\n")); } @@ -188,7 +198,7 @@ GtkWidget *vbox; const XAP_StringSet * pSS = m_pApp->getStringSet(); - + //windowSpell = gtk_window_new (GTK_WINDOW_DIALOG); windowSpell = gtk_dialog_new(); gtk_window_set_title (GTK_WINDOW (windowSpell), pSS->getValue(AP_STRING_ID_DLG_Spell_SpellTitle)); @@ -320,7 +330,7 @@ m_buttonChangeAll = gtk_button_new_with_label (unixstr); FREEP(unixstr); - UT_XML_cloneNoAmpersands(unixstr, + UT_XML_cloneNoAmpersands(unixstr, pSS->getValue(AP_STRING_ID_DLG_Spell_Ignore)); m_buttonIgnore = gtk_button_new_with_label (unixstr); FREEP(unixstr); @@ -386,7 +396,7 @@ } void AP_UnixDialog_Spell::_showMisspelledWord(void) -{ +{ gtk_text_freeze( GTK_TEXT(m_textWord) ); @@ -429,7 +439,7 @@ suggest[0] = (gchar*) _convertToMB((UT_UCSChar*)m_Suggestions.word[i]); gtk_clist_append( GTK_CLIST(m_clistSuggestions), suggest); } - + if (!m_Suggestions.count) { const XAP_StringSet * pSS = m_pApp->getStringSet(); @@ -452,7 +462,7 @@ } gtk_clist_thaw(GTK_CLIST(m_clistSuggestions) ); - + } void AP_UnixDialog_Spell::_populateWindowData(void) @@ -513,12 +523,13 @@ changeWordWith(replace); FREEP(replace); } - + gtk_main_quit(); } void AP_UnixDialog_Spell::event_Ignore() { + addIgnoreAll(); ignoreWord(); gtk_main_quit(); } @@ -527,13 +538,14 @@ { addIgnoreAll(); ignoreWord(); + m_bIgnoreAll = true; gtk_main_quit(); } void AP_UnixDialog_Spell::event_AddToDict() { addToDict(); - + ignoreWord(); gtk_main_quit(); } @@ -547,9 +559,9 @@ void AP_UnixDialog_Spell::event_SuggestionSelected(gint row, gint column) { if (!m_Suggestions.count) return; - + m_iSelectedRow = row; - + gchar * newreplacement = NULL; gtk_clist_get_text(GTK_CLIST(m_clistSuggestions), row, column, &newreplacement); UT_ASSERT(newreplacement);