Author: dpage
Date: 2006-01-11 09:19:12 +0000 (Wed, 11 Jan 2006)
New Revision: 4887

Modified:
   trunk/pgadmin3/CHANGELOG.txt
   trunk/pgadmin3/docs/en_US/options-tab3.html
   trunk/pgadmin3/src/ctl/ctlSQLResult.cpp
   trunk/pgadmin3/src/frm/frmOptions.cpp
   trunk/pgadmin3/src/include/sysSettings.h
   trunk/pgadmin3/src/ui/frmOptions.xrc
   trunk/pgadmin3/src/utils/sysSettings.cpp
Log:
Allow result copy quoting configuration to be set explicitly rather than using 
the result export settings [Magnus Hagander]

Modified: trunk/pgadmin3/CHANGELOG.txt
===================================================================
--- trunk/pgadmin3/CHANGELOG.txt        2006-01-09 15:43:07 UTC (rev 4886)
+++ trunk/pgadmin3/CHANGELOG.txt        2006-01-11 09:19:12 UTC (rev 4887)
@@ -18,6 +18,7 @@
 </ul>
 <br>
 <ul>
+    <li>2006-01-11 DP         Allow result copy quoting configuration to be 
set explicitly rather than using the result export settings [Magnus Hagander]
     <li>2006-01-09 DP         Add -a and -q command line options to auto 
connect to a server and open a query window respectively [Magnus Hagander]
     <li>2006-01-09 DP  1.4.2  Honour the copy quoting setting properly in the 
SQL results pane [Magnus Hagander]
     <li>2006-01-09 DP         Use Ctrl-A to select all results in the query 
results pane. [Magnus Hagander]

Modified: trunk/pgadmin3/docs/en_US/options-tab3.html
===================================================================
--- trunk/pgadmin3/docs/en_US/options-tab3.html 2006-01-09 15:43:07 UTC (rev 
4886)
+++ trunk/pgadmin3/docs/en_US/options-tab3.html 2006-01-11 09:19:12 UTC (rev 
4887)
@@ -30,6 +30,20 @@
   <li><b>Count rows if estimated less than</b>&nbsp;- In the object browser, 
if 
   the estimated number of rows in a table (as read from the table statistics) 
is 
   below this limit, a SELECT count(*) will be performed to find the exact 
value.<br>&nbsp;</li>
+
+  <li><b>Indent characters</b> - This option specifies the number of characters
+  to indent with.<br>&nbsp;</li>
+
+  <li><b>Result copy quoting</b> - This option specifies how the fields should 
be quoted when
+  copied to the clipboard from the result list. Quoting can be applied to 
string columns only
+  (i.e. numeric columns will not be quoted) or all columns regardless of data 
type.<br>&nbsp;</li>
+
+  <li><b>Result copy quote character</b> - This option specifies which 
character should be used
+  to quote the values when copied to the clipboard from the result list. It 
has no effect if 
+  Result copy quoting is set to none.<br>&nbsp;</li>
+
+  <li><b>Result copy field separator</b> - This option specifies which 
character should be used
+  to separate the fields copied to the clipboard from the result 
list.<br>&nbsp;</li>
   
    <li><b>Copy SQL from main form to SQL dialogue</b> - When opening the Query 
    Tool, with this option selected, any object definition being displayed in 
the 

Modified: trunk/pgadmin3/src/ctl/ctlSQLResult.cpp
===================================================================
--- trunk/pgadmin3/src/ctl/ctlSQLResult.cpp     2006-01-09 15:43:07 UTC (rev 
4886)
+++ trunk/pgadmin3/src/ctl/ctlSQLResult.cpp     2006-01-11 09:19:12 UTC (rev 
4887)
@@ -74,12 +74,12 @@
     for (col=1 ; col < GetColumnCount() ; col++)
     {
         if (col > 1)
-            str.Append(settings->GetExportColSeparator());
+            str.Append(settings->GetCopyColSeparator());
 
         wxString text=GetItemText(row, col);
 
                bool needQuote  = false;
-               if (settings->GetExportQuoting() == 1)
+               if (settings->GetCopyQuoting() == 1)
                {
                        /* Quote strings only */
                        switch (colTypClasses.Item(col))
@@ -92,15 +92,15 @@
                                break;
                        }
                }
-               else if (settings->GetExportQuoting() == 2)
+               else if (settings->GetCopyQuoting() == 2)
                        /* Quote everything */
                        needQuote = true;
 
                if (needQuote)
-            str.Append(settings->GetExportQuoteChar());
+            str.Append(settings->GetCopyQuoteChar());
         str.Append(text);
         if (needQuote)
-            str.Append(settings->GetExportQuoteChar());
+            str.Append(settings->GetCopyQuoteChar());
     }    
     return str;
 }

Modified: trunk/pgadmin3/src/frm/frmOptions.cpp
===================================================================
--- trunk/pgadmin3/src/frm/frmOptions.cpp       2006-01-09 15:43:07 UTC (rev 
4886)
+++ trunk/pgadmin3/src/frm/frmOptions.cpp       2006-01-11 09:19:12 UTC (rev 
4887)
@@ -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());

Modified: trunk/pgadmin3/src/include/sysSettings.h
===================================================================
--- trunk/pgadmin3/src/include/sysSettings.h    2006-01-09 15:43:07 UTC (rev 
4886)
+++ trunk/pgadmin3/src/include/sysSettings.h    2006-01-11 09:19:12 UTC (rev 
4887)
@@ -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

Modified: trunk/pgadmin3/src/ui/frmOptions.xrc
===================================================================
--- trunk/pgadmin3/src/ui/frmOptions.xrc        2006-01-09 15:43:07 UTC (rev 
4886)
+++ trunk/pgadmin3/src/ui/frmOptions.xrc        2006-01-11 09:19:12 UTC (rev 
4887)
@@ -3,7 +3,7 @@
   <object class="wxDialog" name="frmOptions">
     <title>Options</title>
     <pos>0,0d</pos>
-    <size>246,166d</size>
+    <size>246,196d</size>
     
<style>wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxCAPTION|wxSYSTEM_MENU</style>
     <object class="wxNotebook" name="nbOptions">
       <object class="notebookpage">
@@ -283,7 +283,7 @@
             <pos>175,20d</pos>
             
             
-            <size>35,-1d</size>
+            <size>55,-1d</size>
             
             
             <tooltip>Maximums rows to retrieve into output window; 0 = 
unlimited</tooltip>
@@ -305,7 +305,7 @@
             <pos>175,35d</pos>
             
             
-            <size>35,-1d</size>
+            <size>55,-1d</size>
           </object>
           <object class="wxStaticText" name="stAutoRowCount">
             
@@ -321,7 +321,7 @@
             <pos>175,50d</pos>
             
             
-            <size>35,-1d</size>
+            <size>55,-1d</size>
           </object>
           <object class="wxStaticText" name="stIndent">
             <label>Indent characters</label>
@@ -329,8 +329,53 @@
           </object>
           <object class="wxTextCtrl" name="txtIndent">
             <pos>175,65d</pos>
-            <size>35,-1d</size>
+            <size>55,-1d</size>
           </object>
+          
+          <object class="wxStaticText" name="stCopyQuote">
+           <label>Result copy quoting</label>
+           <pos>5,82d</pos>
+          </object>
+          <object class="wxComboBox" name="cbCopyQuote">
+           <content>
+            <item>None</item>
+            <item>Strings</item>
+            <item>All</item>
+           </content>
+           <pos>175,80d</pos>
+           <size>55,-1d</size>
+           <style>wxCB_READONLY|wxCB_DROPDOWN</style>
+          </object>
+          
+          <object class="wxStaticText" name="stCopyQuoteChar">
+           <label>Result copy quote character</label>
+           <pos>5,97d</pos>
+          </object>
+          <object class="wxComboBox" name="cbCopyQuoteChar">
+           <content>
+            <item>"</item>
+            <item>'</item>
+           </content>
+           <pos>175,95d</pos>
+           <size>55,-1d</size>
+           <style>wxCB_DROPDOWN</style>
+          </object>
+
+          <object class="wxStaticText" name="stCopySeparator">
+           <label>Result copy field separator</label>
+           <pos>5,112d</pos>
+          </object>
+          <object class="wxComboBox" name="cbCopySeparator">
+           <content>
+            <item>;</item>
+            <item>,</item>
+            <item>|</item>
+           </content>
+           <pos>175,110d</pos>
+           <size>55,-1d</size>
+           <style>wxCB_DROPDOWN</style>
+          </object>
+
           <object class="wxCheckBox" name="chkStickySql">
             
             
@@ -340,7 +385,7 @@
             <checked>1</checked>
             
             
-            <pos>5,82d</pos>
+            <pos>5,127d</pos>
             
             
             <size>226,12d</size>
@@ -418,7 +463,7 @@
         </object>
       </object>
       <pos>2,3d</pos>
-      <size>240,141d</size>
+      <size>240,171d</size>
     </object>
     <object class="wxButton" name="wxID_HELP">
       
@@ -426,7 +471,7 @@
       <label>&amp;Help</label>
       
       
-      <pos>2,147d</pos>
+      <pos>2,177d</pos>
       
       
       <tooltip>Accept the current settings and close the dialogue.</tooltip>
@@ -440,7 +485,7 @@
       <default>1</default>
       
       
-      <pos>140,147d</pos>
+      <pos>140,177d</pos>
       
       
       <tooltip>Accept the current settings and close the dialogue.</tooltip>
@@ -454,7 +499,7 @@
       <default>0</default>
       
       
-      <pos>193,147d</pos>
+      <pos>193,177d</pos>
       
       
       <tooltip>Cancel any changes and close the dialogue.</tooltip>

Modified: trunk/pgadmin3/src/utils/sysSettings.cpp
===================================================================
--- trunk/pgadmin3/src/utils/sysSettings.cpp    2006-01-09 15:43:07 UTC (rev 
4886)
+++ trunk/pgadmin3/src/utils/sysSettings.cpp    2006-01-11 09:19:12 UTC (rev 
4887)
@@ -169,6 +169,15 @@
         exportQuoting = 1;
     else
         exportQuoting = 0;
+       Read(wxT("Copy/ColSeparator"), &copyColSeparator, wxT(";"));
+       Read(wxT("Copy(QuoteChar"), &copyQuoteChar, 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())


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to