diff --git a/ctl/ctlSQLResult.cpp b/ctl/ctlSQLResult.cpp index 1ccf200..15dca1a 100644 --- a/ctl/ctlSQLResult.cpp +++ b/ctl/ctlSQLResult.cpp @@ -332,6 +332,36 @@ wxString ctlSQLResult::OnGetItemText(long item, long col) const } return wxEmptyString; } +wxString ctlSQLResult::CopySelColumnNameType() +{ + size_t i; + wxString ss = wxEmptyString; + if (GetSelectedCols().GetCount()) { + wxArrayInt cols = GetSelectedCols(); + int err = 0; + int noformat = 0; + int dtType = -1; + //AppendColumnHeader(str, cols); + //str.Append(GetExportLine(i, cols)); + for (size_t col = 0; col < cols.Count(); col++) + { + int cl = cols[col]; + bool isDt = false; + wxString colName = colNames.Item(cl); + wxString colType = colTypes.Item(cl); + if (!ss.IsEmpty()) ss.Append(", "); + ss.Append(colName + " " + colType); + + } + } + if (wxTheClipboard->Open()) + { + wxTheClipboard->SetData(new wxTextDataObject(ss)); + wxTheClipboard->Close(); + } + + return ss; +} wxString ctlSQLResult::CheckSelColumnDate() { size_t i; diff --git a/frm/frmQuery.cpp b/frm/frmQuery.cpp index dad1246..261069c 100644 --- a/frm/frmQuery.cpp +++ b/frm/frmQuery.cpp @@ -124,6 +124,7 @@ BEGIN_EVENT_TABLE(frmQuery, pgFrame) EVT_MENU(MNU_COPY_WHERELIST, frmQuery::OnCopy_WhereList) EVT_MENU(MNU_CLEAR_FILTER, frmQuery::OnClear_Filter) EVT_MENU(MNU_CHECK_COLUMN_DATE, frmQuery::OnCheck_Column_Date) + EVT_MENU(MNU_COPY_LISTCOLTYPE, frmQuery::OnCopy_NameTypeCols) EVT_MENU(MNU_AUTOCOLSPLOT, frmQuery::OnAutoColsPlot) EVT_MENU(MNU_FIND, frmQuery::OnSearchReplace) EVT_MENU(MNU_UNDO, frmQuery::OnUndo) @@ -2172,18 +2173,23 @@ void frmQuery::OnLabelRightClick(wxGridEvent &event) xmenu->Append(MNU_COPY, _("&Copy"), _("Copy selected cells to clipboard.")); xmenu->Append(MNU_PASTE, _("&Paste"), _("Paste data from the clipboard.")); xmenu->Append(MNU_DELETE, _("&Delete"), _("Delete selected rows.")); + xmenu->AppendSeparator(); + xmenu->Append(MNU_COPY_INSERT, _("Copy Insert format"), _("Copy Insert format.")); + xmenu->Append(MNU_COPY_LISTCOLTYPE, _("List columns header"), _("Copy list columns header")); + xmenu->Append(MNU_COPY_INLIST, _("IN list format copy"), _("Copy In list format.")); + xmenu->Append(MNU_COPY_WHERELIST, _("WHERE list format copy"), _("Copy where list format.")); + xmenu->AppendSeparator(); xmenu->Append(MNU_AUTOCOLSPLOT, _("Draw plot LY(bar) or LXY or XYYY..."), _("Draw plot LY(bar) LXY or XYYY...")); xmenu->Append(MNU_SUMMARY_COL, _("Summary"), _("Summary selected cells.")); xmenu->Append(MNU_CHECK_COLUMN_DATE, _("Check the sequence of dates"), _("Check the sequence of dates")); - xmenu->Append(MNU_COPY_INSERT, _("Copy Insert format"), _("Copy Insert format.")); - xmenu->Append(MNU_COPY_INLIST, _("IN LIST format copy"), _("Copy In list format.")); - xmenu->Append(MNU_COPY_WHERELIST, _("WHERE LIST format copy"), _("Copy where list format.")); xmenu->Append(MNU_CLEAR_FILTER, _("Clear filter"), _("Clear filter")); bool selcol = sqlResult->GetSelectedCols().GetCount() > 0; xmenu->Enable(MNU_CHECK_COLUMN_DATE, selcol); + xmenu->Enable(MNU_COPY_LISTCOLTYPE, selcol); xmenu->Enable(MNU_AUTOCOLSPLOT, sqlResult->IsSelection()); xmenu->Enable(MNU_SUMMARY_COL, sqlResult->IsSelection()); xmenu->Enable(MNU_COPY_INLIST, sqlResult->IsSelection()); + xmenu->Enable(MNU_COPY_WHERELIST, sqlResult->IsSelection()); if ((rows.GetCount())) @@ -2251,6 +2257,15 @@ void frmQuery::OnClear_Filter(wxCommandEvent &ev) isfilterresult=false; } } + +void frmQuery::OnCopy_NameTypeCols(wxCommandEvent& ev) +{ + // if (currentControl() == sqlResult) + { + wxString s = sqlResult->CopySelColumnNameType(); + SetStatusText(s, STATUSPOS_MSGS); + } +} void frmQuery::OnCheck_Column_Date(wxCommandEvent& ev) { // if (currentControl() == sqlResult) diff --git a/include/ctl/ctlSQLResult.h b/include/ctl/ctlSQLResult.h index 9383137..4676cef 100644 --- a/include/ctl/ctlSQLResult.h +++ b/include/ctl/ctlSQLResult.h @@ -50,6 +50,7 @@ public: wxString SummaryColumn(); wxString AutoColsPlot(int flags,frmQuery *parent); wxString CheckSelColumnDate(); + wxString CopySelColumnNameType(); void ClearFilter(); bool IsColText(int col); bool hasRowNumber() diff --git a/include/frm/frmQuery.h b/include/frm/frmQuery.h index 04d91bd..a9f2338 100644 --- a/include/frm/frmQuery.h +++ b/include/frm/frmQuery.h @@ -218,6 +218,7 @@ private: void OnCopy_InList(wxCommandEvent& event); void OnCopy_WhereList(wxCommandEvent& event); void OnClear_Filter(wxCommandEvent &event); + void OnCopy_NameTypeCols(wxCommandEvent& ev); void OnCheck_Column_Date(wxCommandEvent& ev); void OnAutoColsPlot(wxCommandEvent& ev); void OnSearchReplace(wxCommandEvent &event); diff --git a/include/frm/menu.h b/include/frm/menu.h index 7f0dbe8..f1f1170 100644 --- a/include/frm/menu.h +++ b/include/frm/menu.h @@ -78,6 +78,7 @@ enum MNU_SUMMARY_COL, MNU_COPY_INSERT, MNU_COPY_INLIST, + MNU_COPY_LISTCOLTYPE, MNU_COPY_WHERELIST, MNU_CLEAR_FILTER, MNU_CHECK_COLUMN_DATE, diff --git a/x64/Release_(3.0)/pgAdmin3.exe b/x64/Release_(3.0)/pgAdmin3.exe index 0786f3f..70a9775 100644 Binary files a/x64/Release_(3.0)/pgAdmin3.exe and b/x64/Release_(3.0)/pgAdmin3.exe differ