patch: SmartQuotesEnable preference item


Subject: patch: SmartQuotesEnable preference item
From: WJCarpenter (bill-abisource@carpenter.ORG)
Date: Sat Jul 15 2000 - 00:28:12 CDT


This patch, against 071400 nightly sources, provides

1. A new user preference item: SmartQuotesEnable="1". This item
will eventually control whether smart quote characters are generated
on the fly as a user types.

2. A Unix GUI for turning it on and off. It's a new tab in the
Tools->Options dialog box. Later, I think there will be some
additional items on that tab of that dialog box.

All changes are XP or Unix, tested on Linux.

-- 
bill@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3

diff -ru abi-071400-ORIG/src/af/xap/xp/xap_Prefs_SchemeIds.h abi-071400/src/af/xap/xp/xap_Prefs_SchemeIds.h --- abi-071400-ORIG/src/af/xap/xp/xap_Prefs_SchemeIds.h Fri Jul 7 16:46:50 2000 +++ abi-071400/src/af/xap/xp/xap_Prefs_SchemeIds.h Fri Jul 14 17:32:05 2000 @@ -63,6 +63,10 @@ #define XAP_PREF_DEFAULT_RemapGlyphsTable "‘`’'“"”"" /* smart quotes */ +#define XAP_PREF_KEY_SmartQuotesEnable "SmartQuotesEnable" +/* substitute curly smart quotes on the fly */ +#define XAP_PREF_DEFAULT_SmartQuotesEnable "1" + #else /* XAP_PREFS_SCHEMEID_H */ #ifdef dcl @@ -73,6 +77,8 @@ dcl(RemapGlyphsNoMatterWhat) dcl(RemapGlyphsDefault) dcl(RemapGlyphsTable) + +dcl(SmartQuotesEnable) #endif /* dcl */ #endif /* XAP_PREFS_SCHEMEID_H */ diff -ru abi-071400-ORIG/src/wp/ap/unix/ap_UnixDialog_Options.cpp abi-071400/src/wp/ap/unix/ap_UnixDialog_Options.cpp --- abi-071400-ORIG/src/wp/ap/unix/ap_UnixDialog_Options.cpp Wed May 10 21:16:58 2000 +++ abi-071400/src/wp/ap/unix/ap_UnixDialog_Options.cpp Fri Jul 14 21:32:15 2000 @@ -188,6 +188,7 @@ GtkWidget *windowOptions; GtkWidget *notebook1; + GtkWidget *tableSpell; GtkWidget *checkbuttonSpellHideErrors; GtkWidget *checkbuttonSpellSuggest; @@ -205,12 +206,18 @@ GtkWidget *listSpellDicts_menu; GtkWidget *glade_menuitem; GtkWidget *labelSpell; + + GtkWidget *tableSmartQuotes; + GtkWidget *checkbuttonSmartQuotesEnable; + GtkWidget *labelSmartQuotes; + GtkWidget *tablePreferences; GtkWidget *checkbuttonPrefsAutoSave; GtkWidget *label6; GtkWidget *comboPrefsSchemes; GtkWidget *comboPrefsSchemesEdit; GtkWidget *labelPreferences; + GtkWidget *hboxView; GtkWidget *vbox4; GtkWidget *frame2; @@ -236,6 +243,7 @@ (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (notebook1); + // SPELL //////////////////////////////////////////////////////////////// tableSpell = gtk_table_new (9, 3, FALSE); gtk_widget_ref (tableSpell); gtk_object_set_data_full (GTK_OBJECT (windowOptions), "tableSpell", tableSpell, @@ -376,6 +384,7 @@ gtk_widget_show (labelSpell); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), labelSpell); + // PREFERENCES //////////////////////////////////////////////////////////////// tablePreferences = gtk_table_new (2, 3, FALSE); gtk_widget_ref (tablePreferences); gtk_object_set_data_full (GTK_OBJECT (windowOptions), "tablePreferences", tablePreferences, @@ -585,6 +594,34 @@ ////////////////////////////////////////////////////////////////////// // END: glade stuff + + // SMART QUOTES //////////////////////////////////////////////////////////////// + tableSmartQuotes = gtk_table_new (2, 3, FALSE); + gtk_widget_ref (tableSmartQuotes); + gtk_object_set_data_full (GTK_OBJECT (windowOptions), "tableSmartQuotes", tableSmartQuotes, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (tableSmartQuotes); + gtk_container_add (GTK_CONTAINER (notebook1), tableSmartQuotes); + gtk_container_set_border_width (GTK_CONTAINER (tableSmartQuotes), 10); + + checkbuttonSmartQuotesEnable = gtk_check_button_new_with_label (pSS->getValue(AP_STRING_ID_DLG_Options_Label_SmartQuotesEnable)); + gtk_widget_ref (checkbuttonSmartQuotesEnable); + gtk_object_set_data_full (GTK_OBJECT (windowOptions), "checkbuttonSmartQuotesEnable", checkbuttonSmartQuotesEnable, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (checkbuttonSmartQuotesEnable); + gtk_table_attach (GTK_TABLE (tableSmartQuotes), checkbuttonSmartQuotesEnable, 0, 3, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + labelSmartQuotes = gtk_label_new (pSS->getValue(AP_STRING_ID_DLG_Options_TabLabel_SmartQuotes)); + gtk_widget_ref (labelSmartQuotes); + gtk_object_set_data_full (GTK_OBJECT (windowOptions), "labelSmartQuotes", labelSmartQuotes, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (labelSmartQuotes); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), labelSmartQuotes); + + ////////////////////////////////////////////////////////////////// + m_notebook = notebook1; m_checkbuttonSpellCheckAsType = checkbuttonSpellCheckAsType; @@ -600,6 +637,8 @@ m_buttonSpellIgnoreEdit = buttonSpellIgnoreEdit; m_buttonSpellIgnoreReset = buttonSpellIgnoreReset; + m_checkbuttonSmartQuotesEnable = checkbuttonSmartQuotesEnable; + m_checkbuttonPrefsAutoSave = checkbuttonPrefsAutoSave; m_comboPrefsScheme = comboPrefsSchemes; @@ -840,6 +879,12 @@ break; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // smart quotes + case id_CHECK_SMART_QUOTES_ENABLE: + return m_checkbuttonSmartQuotesEnable; + break; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // prefs case id_CHECK_PREFS_AUTO_SAVE: return m_checkbuttonPrefsAutoSave; @@ -933,6 +978,8 @@ DEFINE_GET_SET_BOOL(SpellUppercase); DEFINE_GET_SET_BOOL(SpellNumbers); DEFINE_GET_SET_BOOL(SpellInternet); + +DEFINE_GET_SET_BOOL(SmartQuotesEnable); DEFINE_GET_SET_BOOL(PrefsAutoSave); diff -ru abi-071400-ORIG/src/wp/ap/unix/ap_UnixDialog_Options.h abi-071400/src/wp/ap/unix/ap_UnixDialog_Options.h --- abi-071400-ORIG/src/wp/ap/unix/ap_UnixDialog_Options.h Wed Apr 5 12:21:53 2000 +++ abi-071400/src/wp/ap/unix/ap_UnixDialog_Options.h Fri Jul 14 17:32:32 2000 @@ -54,6 +54,8 @@ SET_GATHER (SpellNumbers, UT_Bool ); SET_GATHER (SpellInternet, UT_Bool ); + SET_GATHER (SmartQuotesEnable, UT_Bool ); + SET_GATHER (PrefsAutoSave, UT_Bool ); SET_GATHER (ViewShowRuler, UT_Bool ); @@ -92,6 +94,8 @@ GtkWidget * m_buttonSpellDictionary; GtkWidget * m_buttonSpellIgnoreEdit; GtkWidget * m_buttonSpellIgnoreReset; + + GtkWidget * m_checkbuttonSmartQuotesEnable; GtkWidget * m_checkbuttonPrefsAutoSave; GtkWidget * m_comboPrefsScheme; diff -ru abi-071400-ORIG/src/wp/ap/xp/ap_Dialog_Options.cpp abi-071400/src/wp/ap/xp/ap_Dialog_Options.cpp --- abi-071400-ORIG/src/wp/ap/xp/ap_Dialog_Options.cpp Thu May 25 11:52:59 2000 +++ abi-071400/src/wp/ap/xp/ap_Dialog_Options.cpp Fri Jul 14 21:44:17 2000 @@ -101,6 +101,8 @@ Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_SpellCheckNumbers, _gatherSpellNumbers() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_SpellCheckInternet, _gatherSpellInternet() ); + Save_Pref_Bool( pPrefsScheme, XAP_PREF_KEY_SmartQuotesEnable, _gatherSmartQuotesEnable() ); + Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_CursorBlink, _gatherViewCursorBlink() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_RulerVisible, _gatherViewShowRuler() ); Save_Pref_Bool( pPrefsScheme, AP_PREF_KEY_ParaVisible, _gatherViewUnprintable() ); @@ -183,6 +185,10 @@ if (pPrefs->getPrefsValueBool(AP_PREF_KEY_SpellCheckInternet,&b)) _setSpellInternet (b); + // ------------ Smart Quotes + if (pPrefs->getPrefsValueBool(XAP_PREF_KEY_SmartQuotesEnable,&b)) + _setSmartQuotesEnable (b); + // ------------ Prefs _setPrefsAutoSave( pPrefs->getAutoSavePrefs() ); diff -ru abi-071400-ORIG/src/wp/ap/xp/ap_Dialog_Options.h abi-071400/src/wp/ap/xp/ap_Dialog_Options.h --- abi-071400-ORIG/src/wp/ap/xp/ap_Dialog_Options.h Wed Nov 17 12:21:33 1999 +++ abi-071400/src/wp/ap/xp/ap_Dialog_Options.h Fri Jul 14 21:51:36 2000 @@ -47,6 +47,8 @@ id_BUTTON_DICTIONARY_EDIT, id_BUTTON_IGNORE_RESET, id_BUTTON_IGNORE_EDIT, + id_CHECK_SMART_QUOTES_ENABLE, + id_CHECK_PREFS_AUTO_SAVE, id_COMBO_PREFS_SCHEME, id_CHECK_VIEW_SHOW_RULER, id_LIST_VIEW_RULER_UNITS, @@ -91,6 +93,8 @@ SET_GATHER (SpellUppercase, UT_Bool); SET_GATHER (SpellNumbers, UT_Bool); SET_GATHER (SpellInternet, UT_Bool); + + SET_GATHER (SmartQuotesEnable, UT_Bool); SET_GATHER (PrefsAutoSave, UT_Bool); diff -ru abi-071400-ORIG/src/wp/ap/xp/ap_String_Id.h abi-071400/src/wp/ap/xp/ap_String_Id.h --- abi-071400-ORIG/src/wp/ap/xp/ap_String_Id.h Sun Jul 9 16:28:31 2000 +++ abi-071400/src/wp/ap/xp/ap_String_Id.h Fri Jul 14 17:32:57 2000 @@ -164,6 +164,7 @@ dcl(DLG_Options_OptionsTitle, "Options") dcl(DLG_Options_TabLabel_Spelling, "Spelling") +dcl(DLG_Options_TabLabel_SmartQuotes, "Smart Quotes") dcl(DLG_Options_TabLabel_Preferences, "Preference Schemes") dcl(DLG_Options_TabLabel_View, "View") @@ -183,6 +184,8 @@ dcl(DLG_Options_Btn_CustomDict, "&Dictionary...") dcl(DLG_Options_Btn_IgnoreReset, "&Reset") dcl(DLG_Options_Btn_IgnoreEdit, "&Edit") + +dcl(DLG_Options_Label_SmartQuotesEnable,"Enable smart quotes") dcl(DLG_Options_Label_PrefsAutoSave, "&Automatically save this Scheme") dcl(DLG_Options_Label_PrefsCurrentScheme, "Current Preferences Scheme")



This archive was generated by hypermail 2b25 : Sat Jul 15 2000 - 00:57:26 CDT