[Greater-commits] r7 - trunk/Administration
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jun 7 18:21:26 CEST 2011
Author: aheinecke
Date: 2011-06-07 18:21:26 +0200 (Tue, 07 Jun 2011)
New Revision: 7
Removed:
trunk/Administration/LastButton.cpp
trunk/Administration/LastButton.h
Modified:
trunk/Administration/CMakeLists.txt
Log:
Remove LastButton.cpp wich is a unused and contains code from myGrid
Modified: trunk/Administration/CMakeLists.txt
===================================================================
--- trunk/Administration/CMakeLists.txt 2011-06-07 16:19:59 UTC (rev 6)
+++ trunk/Administration/CMakeLists.txt 2011-06-07 16:21:26 UTC (rev 7)
@@ -40,7 +40,6 @@
FixedTextCtrl.cpp
GroupDialog.cpp
ImportDialog.cpp
- # LastButton.cpp
MainWindow.cpp
MessageDialog.cpp
MyButton.cpp
Deleted: trunk/Administration/LastButton.cpp
===================================================================
--- trunk/Administration/LastButton.cpp 2011-06-07 16:19:59 UTC (rev 6)
+++ trunk/Administration/LastButton.cpp 2011-06-07 16:21:26 UTC (rev 7)
@@ -1,386 +0,0 @@
-/**************************************************************************
-* Name : MyGrid.cpp (32-Bit)
-*
-* Issue : 05-FEB-2003 - TechniData AG/Markdorf
-*
-* Purpose : Declaration of class MyGrid;
-* this class offers special functions for the used grids
-* wxGrid with the following Modifications:
-* - reacts to clicks on labels
-* - reacts to "ENTER"
-* - has an AutoSize-function which can cope with multi-line-labels
-* - has a funtion for moving rows
-*
-* Changes :
-* [ Date ] - [ Name ] - [ Action ]
-* -------------------------------------------------------------------------
-* <<< Version x.x.x >>>
-* -------------------------------------------------------------------------
-**************************************************************************/
-
-#include "MyGrid.h"
-#include "PanelBase.h"
-
-BEGIN_EVENT_TABLE(MyGrid, wxGrid)
- EVT_KEY_DOWN(MyGrid::OnKey)
- EVT_KEY_UP(MyGrid::OnKey)
- EVT_GRID_SELECT_CELL(MyGrid::OnCellChange)
- EVT_GRID_CELL_LEFT_DCLICK(MyGrid::OnDClick)
- EVT_GRID_LABEL_LEFT_CLICK(MyGrid::OnLabelClick)
-END_EVENT_TABLE()
-
-
-/*********************************************************************
-* Name : MyGrid
-*
-* Issue : 05-FEB-2003 - S.F. - TechniData AG/Markdorf
-*
-* Purpose : Constructor
-*
-* Parameter: parent (i) Parent Window
-* id (i) Window Id
-* pos (i) Window position
-* size (i) Window size
-* style (i) Window style
-* name (i) Window name
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-MyGrid::MyGrid(wxWindow* parent, wxWindowID id,
- const wxPoint& pos, const wxSize& size, long style,
- const wxString& name)
- : wxGrid(parent, id, pos, size, style, name)
-{
- focusFlag = false;
-}
-
-/*********************************************************************
-* Name : OnKey
-*
-* Issue : 05-FEB-2003 - S.F. - TechniData AG/Markdorf
-*
-* Purpose : Handels key events on the grid;
-* - Tab: navigation event is sent to the parent window
-* - Enter: Function which is to be overwritten in derived
-* functions is called
-* - Delete: Delete-Funtion is called
-* - All other events: standard key event handling
-*
-* Parameter: event (i) Event handle
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::OnKey(wxKeyEvent& event)
-{
-
- if (event.GetKeyCode() == WXK_TAB && event.ShiftDown())
- {
- if (focusFlag)
- {
- ((PanelBase*) GetParent())->OnKeyGoBack();
- focusFlag = false;
- }
- else
- {
- focusFlag = true;
- event.Skip();
- }
- }
- else if (event.GetKeyCode() == WXK_TAB)
- {
- wxNavigationKeyEvent tab_event;
- ((PanelBase*) GetParent())->GetEventHandler()->ProcessEvent(tab_event);
- }
- else if (GetRows() >=1)
- {
- if (event.GetKeyCode() == WXK_DELETE)
- {
- ((PanelBase*) GetParent())->OnKeyDelete();
- }
- else if (event.GetKeyCode() == WXK_RETURN)
- {
- ((PanelBase*) GetParent())->OnGridReturnOrDClick();
- }
- else
- {
- //handle as standard event
- event.Skip();
- }
- }
- else
- {
- //handle as standard event
- event.Skip();
- }
-}
-
-
-/*********************************************************************
-* Name : OnCellChange
-*
-* Issue : 05-FEB-2003 - S.F. - TechniData AG/Markdorf
-*
-* Purpose : Handels event cell is changed on the grid;
-* Selects the whole row when a grid cell is selected
-*
-* Parameter: event (i) Event handle
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::OnCellChange(wxGridEvent& event)
-{
- //Select current row
- SelectRow(event.GetRow());
- event.Skip();
-}
-
-
-/*********************************************************************
-* Name : OnLabelClick
-*
-* Issue : 05-FEB-2003 - S.F. - TechniData AG/Markdorf
-*
-* Purpose : Handels event label is clicked on the grid;
-* Calls the sort function, when a column label is clicked
-*
-* Parameter: event (i) Event handle
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::OnLabelClick(wxGridEvent& event)
-{
- if (event.GetCol() >= 0)
- {
- //wxMessageBox("Dummy message OnLabelClick", "Info", wxOK | wxICON_INFORMATION);
- SortResults(event.GetCol());
- }
-}
-
-
-
-
-
-/*********************************************************************
-* Name : OnDCClick
-*
-* Issue : 05-FEB-2003 - S.F. - TechniData AG/Markdorf
-*
-* Purpose : Handels event double click on the grid;
-* Function which is to be overwritten in derived functions is called
-* when a grid cell is double-clicked
-*
-* Parameter: event (i) Event handle
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::OnDClick(wxGridEvent& event)
-{
- ((PanelBase*) GetParent())->OnGridReturnOrDClick();
-}
-
-
-/*********************************************************************
-* Name : OnAutoSize
-*
-* Issue : 05-FEB-2003 - S.F. - TechniData AG/Markdorf
-*
-* Purpose : Controls automatic sizing of the grid;
-* The built-in function AutoSizeColumns can't be used
-* because it has problems with multi-line-labels.
-*
-* Parameter: -
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::AutoSize()
-{
- int col_num = GetCols();
- wxString label_buffer;
-
- BeginBatch();
-
- for (int i = 0; i < col_num; i++)
- {
- label_buffer = GetColLabelValue(i);
-
- // simply calling "SetColLabelValue(i, label_buffer.Left(('\n'));" does not
- // work
- SetColLabelValue(i, label_buffer.Left(label_buffer.Find('\n')));
-
- AutoSizeColumn(i, false);
- SetColLabelValue(i, label_buffer);
- }
-
- EndBatch();
-
-}
-
-/*********************************************************************
-* Name : MoveRow
-*
-* Issue : 05-FEB-2003 - S.F. - TechniData AG/Markdorf
-*
-* Purpose : Moves 1 row from the grid to a different position
-*
-* Parameter: target (i) target row
-* source (i) source row
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::MoveRow(int target, int source)
-{
- int horiz, vert;
-
- InsertRows(target);
-
- for (int i = 0; i < GetCols(); i++)
- {
- SetCellValue(target, i, GetCellValue(source + 1, i));
- GetCellAlignment(source + 1, i, &horiz, &vert);
- SetCellAlignment(horiz, target, i);
- }
-
- DeleteRows(source + 1);
-}
-
-/*********************************************************************
-* Name : SortResults
-*
-* Issue : 05-FEB-2003 - T.L. - TechniData AG/Markdorf
-*
-* Purpose : Sorts the result grid alphabetically or numerically
-* in ascending order by the column whose label was clicked
-*
-* Parameter: column (i) column
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::SortResults(int column)
-{
- //Sort only, in case grid has more than 1 row
- if (this->GetRows() < 1)
- {
- return;
- }
-
- sortcol = column;
-
- //Signal user, that the application is busy
- wxBeginBusyCursor();
- this->BeginBatch();
-
- //Sort grid values by selected column
- Mergesort(0, this->GetRows() - 1);
- this->SetGridCursor(0,0);
- this->MakeCellVisible(0,0);
-
- //signal user, that the application is ready
- this->EndBatch();
- wxEndBusyCursor();
-}
-
-
-/*********************************************************************
-* Name : Mergesort
-*
-* Issue : 05-FEB-2003 - T.L. - TechniData AG/Markdorf
-*
-* Purpose : Recursive function that covers the sort algorythm
-*
-*
-* Parameter: left (i) 0 rows
-* right (i) total number of rows - 1
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::Mergesort(int left, int right)
-{
- int middle = (left + right) / 2;
-
- if (left < right)
- {
- Mergesort(left, middle);
- Mergesort(middle + 1, right);
- }
-
- Merge(left, middle, right);
-}
-
-
-/*********************************************************************
-* Name : Merge
-*
-* Issue : 05-FEB-2003 - T.L. - TechniData AG/Markdorf
-*
-* Purpose : Auxiliary sort function called by Mergesort
-*
-*
-* Parameter: left (i) 0 rows
-* middle (i) total number of rows / 2
-* right (i) total number of rows - 1
-*
-* Return : -
-*
-* Changes :
-*********************************************************************/
-void MyGrid::Merge(int left, int middle, int right)
-{
- int horiz, vert;
- double left_number;
- double middle_number;
-
- middle++;
-
- while ((left < middle) && (middle <= right))
- {
- // numeric and text columns must be treated differently
- // they can be differentiated by their alignment
- this->GetCellAlignment(0, sortcol, &horiz, &vert);
- // text columns
-#ifdef WX229
- if (horiz == wxLEFT)
-#else
- if (horiz == wxALIGN_LEFT)
-#endif
- {
- if ( this->GetCellValue(left, sortcol).CmpNoCase(
- this->GetCellValue(middle, sortcol)) > 0)
- {
- ((PanelBase*) GetParent())->Insert(left, middle);
- middle++;
- }
- }
- // numeric columns
- else
- {
- this->GetCellValue(left, sortcol).ToDouble(&left_number);
- this->GetCellValue(middle, sortcol).ToDouble(&middle_number);
- if ( left_number > middle_number)
- {
- ((PanelBase*) GetParent())->Insert(left, middle);
- middle++;
- }
- }
- left++;
- }
-}
-
-
Deleted: trunk/Administration/LastButton.h
===================================================================
--- trunk/Administration/LastButton.h 2011-06-07 16:19:59 UTC (rev 6)
+++ trunk/Administration/LastButton.h 2011-06-07 16:21:26 UTC (rev 7)
@@ -1,52 +0,0 @@
-/**************************************************************************
-* Name : M.h (32-Bit)
-*
-* Issue : 05-FEB-2003 - TechniData AG/Markdorf
-*
-* Purpose : Declaration of class MyGrid;
-* this class offers special functions for the used grids
-* - reacts to clicks on labels
-* - reacts to "ENTER"
-* - has an AutoSize-function which can cope with multi-line-labels
-* - has a funtion for moving rows*
-* Changes :
-* [ Date ] - [ Name ] - [ Action ]
-* -------------------------------------------------------------------------
-* <<< Version x.x.x >>>
-* -------------------------------------------------------------------------
-**************************************************************************/
-#ifndef __MYGRID_H__
-#define __MYGRID_H__
-
-#include "wx/wxprec.h"
-#include "wx/grid.h"
-extern "C"
-{
- #include "datypes.h"
- #include "daimplib.h"
-}
-
-class MyGrid : public wxGrid
-{
-public:
- MyGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos,
- const wxSize& size, long style=0, const wxString& name="grid");
- void MoveRow(int target, int source);
- void AutoSize();
-
-private:
- void OnKey(wxKeyEvent& event);
- void OnCellChange(wxGridEvent& event);
- void OnDClick(wxGridEvent& event);
- void OnLabelClick(wxGridEvent& event);
- void SortResults(int column);
- void Mergesort(int left, int right);
- void Merge(int left, int middle, int right);
- int sortcol;
- bool focusFlag;
-
- DECLARE_EVENT_TABLE();
-
-};
-
-#endif
More information about the Greater-commits
mailing list