diff --git a/checkin_notes b/checkin_notes index 8637570f86..8f38c3c401 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7617,3 +7617,14 @@ David 1 Aug 2007 client/ gui_rpc_server_ops.C cs_prefs.C + +Charlie 1 Aug 2007 + - MGR: Populate Simple and Advanced Preference dialogs with current + values of preferences (including any overrides), not with + defaults or old (possibly stale) values. + + lib/ + gui_rpc_client_ops.C + clientgui/ + DlgAdvPreferences.cpp + sg_DlgPreferences.cpp diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp index f6f69c0aca..29c4118b2a 100644 --- a/clientgui/DlgAdvPreferences.cpp +++ b/clientgui/DlgAdvPreferences.cpp @@ -33,6 +33,8 @@ #include "hyperlink.h" #include "Events.h" +using std::string; + IMPLEMENT_DYNAMIC_CLASS(CDlgAdvPreferences, wxDialog) BEGIN_EVENT_TABLE(CDlgAdvPreferences, wxDialog) @@ -186,16 +188,18 @@ void CDlgAdvPreferences::ReadPreferenceSettings() { m_bInInit=true;//prevent dialog handlers from doing anything CMainDocument* pDoc = wxGetApp().GetDocument(); wxString buffer; + string current_prefs; + MIOFILE mf; + bool found_venue; + XML_PARSER xp(&mf); wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - //init prefs with defaults - prefs.defaults(); - - //override the global prefs with values in global_prefs_override.xml, if this file exists - mask.clear(); - pDoc->rpc.get_global_prefs_override_struct(prefs, mask); + // Get current working preferences (including any overrides) from client + pDoc->rpc.get_global_prefs_working(current_prefs); + mf.init_buf_read(current_prefs.c_str()); + prefs.parse(xp, "", found_venue, mask); // ######### proc usage page // do work between diff --git a/clientgui/sg_DlgPreferences.cpp b/clientgui/sg_DlgPreferences.cpp index 521bd49fd1..d2b9d4a822 100644 --- a/clientgui/sg_DlgPreferences.cpp +++ b/clientgui/sg_DlgPreferences.cpp @@ -36,6 +36,8 @@ #include "sg_CustomControls.h" #include "sg_DlgPreferences.h" +using std::string; + #ifdef __WXMAC__ #define TINY_FONT 12 #define SMALL_FONT 12 @@ -708,14 +710,21 @@ bool CPanelPreferences::ReadPreferenceSettings() { double dTempValue1 = 0.0; double dTempValue2 = 0.0; int retval; - unsigned int i; + unsigned int i; + string current_prefs; + MIOFILE mf; + bool found_venue; + XML_PARSER xp(&mf); wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); // Populate values and arrays from preferences - global_preferences_override = pDoc->state.global_prefs; + // Get current working preferences (including any overrides) from client + pDoc->rpc.get_global_prefs_working(current_prefs); + mf.init_buf_read(current_prefs.c_str()); + global_preferences_override.parse(xp, "", found_venue, global_preferences_mask); retval = pDoc->rpc.get_global_prefs_override_struct(global_preferences_override, global_preferences_mask); if (!retval && global_preferences_mask.are_simple_prefs_set()) { m_bCustomizedPreferences = true; diff --git a/lib/gui_rpc_client_ops.C b/lib/gui_rpc_client_ops.C index 5a26799772..9077d3e43a 100644 --- a/lib/gui_rpc_client_ops.C +++ b/lib/gui_rpc_client_ops.C @@ -2076,12 +2076,27 @@ int RPC_CLIENT::get_global_prefs_network(string& s) { SET_LOCALE sl; RPC rpc(this); char buf[1024]; + bool found = false; + bool in_prefs = false; + s = ""; retval = rpc.do_rpc(""); if (retval) return retval; while (rpc.fin.fgets(buf, 256)) { - s += buf; + if (in_prefs) { + s += buf; + if (match_tag(buf, "")) { + in_prefs = false; + } + } else { + if (match_tag(buf, "")) { + s += buf; + in_prefs = true; + found = true; + } + } } + if (!found) return ERR_NOT_FOUND; return 0; } @@ -2090,12 +2105,27 @@ int RPC_CLIENT::get_global_prefs_working(string& s) { SET_LOCALE sl; RPC rpc(this); char buf[1024]; + bool found = false; + bool in_prefs = false; + s = ""; retval = rpc.do_rpc(""); if (retval) return retval; while (rpc.fin.fgets(buf, 256)) { - s += buf; + if (in_prefs) { + s += buf; + if (match_tag(buf, "")) { + in_prefs = false; + } + } else { + if (match_tag(buf, "")) { + s += buf; + in_prefs = true; + found = true; + } + } } + if (!found) return ERR_NOT_FOUND; return 0; }