Index: ctl/ctlSQLResult.cpp
===================================================================
--- ctl/ctlSQLResult.cpp (revision 4874)
+++ ctl/ctlSQLResult.cpp (working copy)
@@ -68,27 +68,33 @@
for (col=1 ; col < GetColumnCount() ; col++)
{
if (col > 1)
- str.Append(settings->GetExportColSeparator());
+ str.Append(settings->GetCopyColSeparator());
wxString text=GetItemText(row, col);
- bool needQuote=(settings->GetExportQuoting() > 1);
+ bool needQuote = false;
+ if (settings->GetCopyQuoting() == 1)
+ {
+ /* Quote strings only */
+ switch (colTypClasses.Item(col))
+ {
+ case PGTYPCLASS_NUMERIC:
+ case PGTYPCLASS_BOOL:
+ break;
+ default:
+ needQuote=true;
+ break;
+ }
+ }
+ else if (settings->GetCopyQuoting() == 2)
+ /* Quote everything */
+ needQuote = true;
-
- switch (colTypClasses.Item(col))
- {
- case PGTYPCLASS_NUMERIC:
- case PGTYPCLASS_BOOL:
- break;
- default:
- needQuote=true;
- break;
- }
- if (needQuote)
- str.Append(settings->GetExportQuoteChar());
+ if (needQuote)
+ str.Append(settings->GetCopyQuoteChar());
str.Append(text);
if (needQuote)
- str.Append(settings->GetExportQuoteChar());
+ str.Append(settings->GetCopyQuoteChar());
}
return str;
}
Index: frm/frmOptions.cpp
===================================================================
--- frm/frmOptions.cpp (revision 4874)
+++ frm/frmOptions.cpp (working copy)
@@ -48,6 +48,9 @@
#define chkShowUsersForPrivileges CTRL_CHECKBOX("chkShowUsersForPrivileges")
#define txtAutoRowCount CTRL_TEXT("txtAutoRowCount")
#define txtIndent CTRL_TEXT("txtIndent")
+#define cbCopyQuote CTRL_COMBOBOX("cbCopyQuote")
+#define cbCopyQuoteChar CTRL_COMBOBOX("cbCopyQuoteChar")
+#define cbCopySeparator CTRL_COMBOBOX("cbCopySeparator")
#define chkStickySql CTRL_CHECKBOX("chkStickySql")
#define chkDoubleClickProperties CTRL_CHECKBOX("chkDoubleClickProperties")
#define cbLanguage CTRL_COMBOBOX("cbLanguage")
@@ -103,6 +106,9 @@
chkShowUsersForPrivileges->SetValue(settings->GetShowUsersForPrivileges());
txtAutoRowCount->SetValue(NumToStr(settings->GetAutoRowCountThreshold()));
txtIndent->SetValue(NumToStr(settings->GetIndentSpaces()));
+ cbCopyQuote->SetSelection(settings->GetCopyQuoting());
+ cbCopyQuoteChar->SetValue(settings->GetCopyQuoteChar());
+ cbCopySeparator->SetValue(settings->GetCopyColSeparator());
chkStickySql->SetValue(settings->GetStickySql());
chkDoubleClickProperties->SetValue(settings->GetDoubleClickProperties());
txtSqlHelpSite->SetValue(settings->GetSqlHelpSite());
@@ -218,6 +224,9 @@
settings->SetShowUsersForPrivileges(chkShowUsersForPrivileges->GetValue());
settings->SetAutoRowCountThreshold(StrToLong(txtAutoRowCount->GetValue()));
settings->SetIndentSpaces(StrToLong(txtIndent->GetValue()));
+ settings->SetCopyQuoting(cbCopyQuote->GetCurrentSelection());
+ settings->SetCopyQuoteChar(cbCopyQuoteChar->GetValue());
+ settings->SetCopyColSeparator(cbCopySeparator->GetValue());
settings->SetStickySql(chkStickySql->GetValue());
settings->SetDoubleClickProperties(chkDoubleClickProperties->GetValue());
settings->SetUnicodeFile(chkUnicodeFile->GetValue());
Index: include/sysSettings.h
===================================================================
--- include/sysSettings.h (revision 4874)
+++ include/sysSettings.h (working copy)
@@ -139,12 +139,20 @@
int GetExportQuoting() const { return exportQuoting; } // 0=none 1=string 2=all
bool GetExportUnicode() const { return exportUnicode; }
+ wxString GetCopyQuoteChar() const { return copyQuoteChar; }
+ wxString GetCopyColSeparator() const { return copyColSeparator; }
+ int GetCopyQuoting() const { return copyQuoting; } // 0=none 1=string 2=all
+
void SetExportQuoteChar(const wxString &s) { exportQuoteChar=s; }
void SetExportRowSeparator(const wxString &s) { exportRowSeparator=s; }
void SetExportColSeparator(const wxString &s) { exportColSeparator=s; }
void SetExportQuoting(const int i) { exportQuoting = i; }
void SetExportUnicode(const bool b) { exportUnicode=b; }
+ void SetCopyQuoteChar(const wxString &s) { copyQuoteChar=s; }
+ void SetCopyColSeparator(const wxString &s) { copyColSeparator=s; }
+ void SetCopyQuoting(const int i) { copyQuoting = i; }
+
void Save();
@@ -195,6 +203,11 @@
wxString exportQuoteChar;
int exportQuoting;
bool exportUnicode;
+
+ // copy options
+ wxString copyColSeparator;
+ wxString copyQuoteChar;
+ int copyQuoting;
};
#endif
Index: ui/frmOptions.xrc
===================================================================
--- ui/frmOptions.xrc (revision 4874)
+++ ui/frmOptions.xrc (working copy)
@@ -3,7 +3,7 @@
@@ -426,7 +471,7 @@
- 2,147d
+ 2,162d
Accept the current settings and close the dialogue.
@@ -440,7 +485,7 @@
1
- 140,147d
+ 140,162d
Accept the current settings and close the dialogue.
@@ -454,7 +499,7 @@
0
- 193,147d
+ 193,162d
Cancel any changes and close the dialogue.
Index: utils/sysSettings.cpp
===================================================================
--- utils/sysSettings.cpp (revision 4874)
+++ utils/sysSettings.cpp (working copy)
@@ -169,6 +169,15 @@
exportQuoting = 1;
else
exportQuoting = 0;
+ Read(wxT("Copy/ColSeparator"), ©ColSeparator, wxT(";"));
+ Read(wxT("Copy(QuoteChar"), ©QuoteChar, wxT("\""));
+ Read(wxT("Copy/Quote"), &val, wxT("Strings"));
+ if (val == wxT("All"))
+ copyQuoting = 2;
+ else if (val == wxT("Strings"))
+ copyQuoting = 1;
+ else
+ copyQuoting = 0;
@@ -310,6 +319,23 @@
break;
}
+ Write(wxT("Copy/QuoteChar"), copyQuoteChar);
+ Write(wxT("Copy/ColSeparator"), copyColSeparator);
+ switch (copyQuoting)
+ {
+ case 2:
+ Write(wxT("Copy/Quote"), wxT("All"));
+ break;
+ case 1:
+ Write(wxT("Copy/Quote"), wxT("Strings"));
+ break;
+ case 0:
+ Write(wxT("Copy/Quote"), wxT("None"));
+ break;
+ default:
+ break;
+ }
+
wxString fontName = systemFont.GetNativeFontInfoDesc();
if (fontName == wxSystemSettings::GetFont(wxSYS_ICONTITLE_FONT).GetNativeFontInfoDesc())