From 7439d8e3512c0bff4a9fe003e23aabcae00d1074 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 20 Oct 2011 15:28:07 +0000 Subject: [PATCH] Patch level : Files correlati : agalib Ricompilazione Demo : [ ] Commento : Nuovi tracciati per FE Aggiunta possibilita'di spostare righe dello sheet coi relativi attributi git-svn-id: svn://10.65.10.50/branches/R_10_00@22462 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/alleg.h | 5 +---- include/mov.h | 4 ++-- include/msksheet.cpp | 31 +++++++++++++++++++++++++++++-- include/msksheet.h | 3 ++- include/prefix.cpp | 2 +- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/include/alleg.h b/include/alleg.h index fefe376db..ffb52347d 100755 --- a/include/alleg.h +++ b/include/alleg.h @@ -12,16 +12,13 @@ DEFFLD(TIPOCF) DEFFLD(CODCF) DEFFLD(OCFPI) -// Key 3 = NUMREG -DEFFLD(NUMREG) // Can be null - // Flags DEFFLD(FORZATURA) DEFFLD(IGNORA) // Content fields DEFFLD(DATAREG) -DEFFLD(NUMFATT) +DEFFLD(NUMDOC) DEFFLD(MODPAG) DEFFLD(IMPORTO) DEFFLD(IMPOSTA) diff --git a/include/mov.h b/include/mov.h index 87e07a3b0..56c644a2a 100755 --- a/include/mov.h +++ b/include/mov.h @@ -49,8 +49,8 @@ #define MOV_LIQDIFF "LIQDIFF" #define MOV_MODPAG "MODPAG" #define MOV_CONTRATTO "CONTRATTO" -#define MOV_DATAFATT "DATAFATT" -#define MOV_NUMFATT "NUMFATT" +#define MOV_DATARETT "DATARETT" +#define MOV_NUMRETT "NUMRETT" #define MOV_ANNOFE "ANNOFE" #define MOV_CONTSEP "CONTSEP" diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 01f4486d9..7280dd014 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -316,6 +316,9 @@ public: void swap_columns(const int fromid, const int toid) const; // @cmember Permette di invertire la posizione di due righe void swap_rows(const int fromindex, const int toindex); + // @cmember Sposta la riga fromindex alla posizione toindex + void move_row(const int fromindex, const int toindex); + // @cmember L'utente ha salvato la disposizione delle colonne? bool user_saved_columns_order() const; @@ -2226,10 +2229,28 @@ void TSpreadsheet::swap_columns(const int fromid, const int toid) const void TSpreadsheet::swap_rows( const int fromindex, const int toindex) { - _str.swap(fromindex, toindex); - _property.swap(fromindex, toindex); + if (fromindex != toindex) + { + _str.swap(fromindex, toindex); + _property.swap(fromindex, toindex); + } } +void TSpreadsheet::move_row(const int fromindex, const int toindex) +{ + if (fromindex != toindex) + { + TObject* r = _str.remove(fromindex); + _str.insert(r, toindex, true); + _str.pack(); + + TObject* p = _property.remove(fromindex); + _property.insert(p, toindex, true); + _property.pack(); + } +} + + int TSpreadsheet::set_line_number_width(int digits) { const int old = ROW_NUMBER_WIDTH; @@ -3026,6 +3047,12 @@ void TSheet_field::swap_rows( const int fromindex, const int toindex) s->swap_rows(fromindex, toindex); } +void TSheet_field::move_row(const int fromindex, const int toindex) const +{ + TSpreadsheet* s = (TSpreadsheet*)_ctl; + s->move_row(fromindex, toindex); +} + static int default_rows_compare(TSheet_field &s, int i, int j) { TToken_string &s1 = s.row(i); diff --git a/include/msksheet.h b/include/msksheet.h index 23891ac2a..ee4ab90b6 100755 --- a/include/msksheet.h +++ b/include/msksheet.h @@ -231,7 +231,8 @@ public: bool row_enabled(int row); // @cmember Permette di invertire la posizione di due righe void swap_rows( const int fromindex, const int toindex ) ; - + void move_row(const int fromindex, const int toindex) const; + // @cmember Permette di ordinare le righe dello sheet void sort(ROWS_COMPARE_FUNCTION = NULL); diff --git a/include/prefix.cpp b/include/prefix.cpp index ac228b635..b39d87b4c 100755 --- a/include/prefix.cpp +++ b/include/prefix.cpp @@ -428,7 +428,7 @@ int TFile_info::close() if (_ref_count > 0) { _ref_count--; - if (_ref_count == 0 || (_exclusive && _ref_count < 2)) + if (_ref_count == 0 || _exclusive) { if (is_open()) {