From 6a6ae049eda8f644f9ad82a228013606dca89853 Mon Sep 17 00:00:00 2001 From: unodgs Date: Fri, 29 Aug 2008 13:23:14 +0000 Subject: [PATCH] added GetVisibleCount, activated WhenPasteCell git-svn-id: svn://ultimatepp.org/upp/trunk@384 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/GridCtrl/GridBase.cpp | 2 ++ uppsrc/GridCtrl/GridCtrl.cpp | 18 +++++++++++++----- uppsrc/GridCtrl/GridCtrl.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/uppsrc/GridCtrl/GridBase.cpp b/uppsrc/GridCtrl/GridBase.cpp index beb9ed069..20577c61d 100644 --- a/uppsrc/GridCtrl/GridBase.cpp +++ b/uppsrc/GridCtrl/GridBase.cpp @@ -59,6 +59,8 @@ GridCtrl::ItemRect& GridCtrl::ItemRect::Name(const char * s) GridCtrl::ItemRect& GridCtrl::ItemRect::Size(int n) { hidden = n == 0; + + n = Ctrl::VertLayoutZoom(n); if(!hidden) { diff --git a/uppsrc/GridCtrl/GridCtrl.cpp b/uppsrc/GridCtrl/GridCtrl.cpp index 1d7b992ba..5393215d0 100644 --- a/uppsrc/GridCtrl/GridCtrl.cpp +++ b/uppsrc/GridCtrl/GridCtrl.cpp @@ -813,10 +813,9 @@ void GridCtrl::Paste(int mode) if(fixed_paste && new_row) break; - String& s = cells[j]; -// WhenPasteCell(i, j, s); - - Set0(lr, lc, s, true); + Value v(cells[j]); + WhenPasteCell(i, j, v); + Set0(lr, lc, v, true); } if(i == lines.GetCount() - 1 && j == cells.GetCount() - 1) @@ -4945,7 +4944,7 @@ bool GridCtrl::Key(dword key, int) } return false; case K_CTRL_W: - //WriteClipboardText(GetColumnWidths()); + WriteClipboardText(GetColumnWidths()); return true; default: if(searching && !ctrls && Search(key)) @@ -5909,6 +5908,15 @@ int GridCtrl::GetCount() const { return total_rows - fixed_rows; } int GridCtrl::GetFixedCount() const { return fixed_rows; } int GridCtrl::GetTotalCount() const { return total_rows; } +int GridCtrl::GetVisibleCount() const +{ + int cnt = 0; + for(int i = fixed_rows; i < total_rows; i++) + if(!vitems[i].hidden) + ++cnt; + return cnt; +} + GridCtrl& GridCtrl::SetColsMin(int size) { for(int i = 1; i < total_cols; i++) diff --git a/uppsrc/GridCtrl/GridCtrl.h b/uppsrc/GridCtrl/GridCtrl.h index 41d4120a0..eb77a9405 100644 --- a/uppsrc/GridCtrl/GridCtrl.h +++ b/uppsrc/GridCtrl/GridCtrl.h @@ -1368,6 +1368,7 @@ class GridCtrl : public Ctrl int GetCount() const; int GetRowCount() const { return GetCount(); } + int GetVisibleCount() const; int GetFixedCount() const; int GetTotalCount() const;