コード例 #1
0
void SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList()
{
    m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 );
    m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 );

    // Select a not show cell, to avoid a wrong cell selection for user

    int         row = 0;
    wxString    layername;

    for( LSEQ ui_seq = m_brd->GetEnabledLayers().UIOrder();  ui_seq;  ++ui_seq )
    {
        LAYER_ID  layerid = *ui_seq;

        if( !IsCopperLayer( layerid ) )
            break;

        COLOR4D color = GetLayerColor( layerid );

        layername = GetLayerName( layerid );

        if( row )
            m_leftGridLayers->AppendRows( 1 );

        m_leftGridLayers->SetCellBackgroundColour( row, COLOR_COLNUM, color.ToColour() );
        m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername );
        m_layersId.push_back( layerid );

        if( m_frontLayer == layerid )
        {
            SetGridCursor( m_leftGridLayers, row, true );
            m_leftRowSelected = row;
        }

        if( row )
            m_rightGridLayers->AppendRows( 1 );
        m_rightGridLayers->SetCellBackgroundColour ( row, COLOR_COLNUM,
                                                     color.ToColour() );
        m_rightGridLayers->SetCellValue( row, LAYERNAME_COLNUM,
                                         layername );

        if( m_backLayer == layerid )
        {
            SetGridCursor( m_rightGridLayers, row, true );
            m_rightRowSelected = row;
        }

        row++;
    }

    m_leftGridLayers->AutoSizeColumn(LAYERNAME_COLNUM);
    m_rightGridLayers->AutoSizeColumn(LAYERNAME_COLNUM);
    m_leftGridLayers->AutoSizeColumn(SELECT_COLNUM);
    m_rightGridLayers->AutoSizeColumn(SELECT_COLNUM);
}
コード例 #2
0
//---------------------------------------------------------
void CActive_Attributes_Control::On_LClick_Label(wxGridEvent &event)
{
	if( event.GetCol() >= 0 )
	{
		SetGridCursor(GetGridCursorRow(), event.GetCol());
	}
	else if( event.GetRow() >= 0 )
	{
		SetGridCursor(event.GetRow(), GetGridCursorCol());
	}
}
コード例 #3
0
void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnRightGridCellClick( wxGridEvent& event )
{
    int         row = event.GetRow();
    LAYER_ID    layer = m_layersId[row];

    if( m_backLayer == layer )
        return;

    SetGridCursor( m_rightGridLayers, m_rightRowSelected, false );
    m_backLayer = layer;
    m_rightRowSelected = row;
    SetGridCursor( m_rightGridLayers, m_rightRowSelected, true );
}
コード例 #4
0
//---------------------------------------------------------
void CVIEW_Table_Control::On_LClick_Label(wxGridEvent &event)
{
	if( event.GetCol() >= 0 )
	{
		SetGridCursor	(GetGridCursorRow(), event.GetCol());
	}
	else if( event.GetRow() >= 0 )
	{
		SetGridCursor	(event.GetRow(), GetGridCursorCol());
	}
	else
	{
	//	SelectAll();
	}
}
コード例 #5
0
ファイル: DataGrid.cpp プロジェクト: lasyard/HomeAccount
void DataGrid::updateData(bool setModified)
{
	if (setModified) m_data->setModified();
	showMainData();
	updateBalanceAndTotal();
	SetGridCursor(GetGridCursorRow(), OutlayIndex);
}
コード例 #6
0
ファイル: CGridLocus.cpp プロジェクト: Klortho/osiris
bool CGridLocus::XferName(int nCol, COARallele *pAllele)
{
    bool bRtn = true;
    if(!GetBoolValue(ROW_DISABLE,nCol))
    {
        bool bAmel = m_pLocusEdited->IsAmel();
        s = GetCellValue(ROW_ALLELE,nCol);
        nwxString::Trim(&s);
        if(bAmel)
        {
            s.MakeUpper();
            const char *ps = s.c_str();
            if( (!*ps) || (strchr("XY12",*ps) == NULL) )
            {
                // not x/y
                bRtn = false;
                mainApp::ShowError(_T("Invalid allele name"),this);
                SetCellValue(ROW_ALLELE,nCol,pAllele->FormatName(true,false));
                SetGridCursor(ROW_ALLELE,nCol);
                SelectBlock(ROW_ALLELE,nCol,ROW_ALLELE,nCol);
            }
        }
        if(bRtn)
        {
            pAllele->SetName(s,bAmel);
        }
    }
    return bRtn;
}
コード例 #7
0
ファイル: CListView.cpp プロジェクト: CocacolaSh/SpellEditor
void CListView::OnCellLeftClick(wxGridEvent& ev)
{
	// This forces the cell to go into edit mode directly
	m_waitForSlowClick = TRUE;
	SetGridCursor(ev.GetRow(), ev.GetCol());
	// Store the click co-ordinates in the editor if possible
	// if an editor has created a ClientData area, we presume it's
	// a wxPoint and we store the click co-ordinates
	wxGridCellEditor* pEditor  = GetCellEditor(ev.GetRow(), ev.GetCol());
	wxPoint* pClickPoint = (wxPoint*)pEditor->GetClientData();
	if (pClickPoint)
	{
		*pClickPoint = ClientToScreen(ev.GetPosition());
#ifndef __WINDOWS__
		EnableCellEditControl(true);
#endif
	}
	// hack to prevent selection from being lost when click combobox
	if (ev.GetCol() == 0 && IsInSelection(ev.GetRow(), ev.GetCol()))
	{
		m_selTemp = m_selection;
		m_selection = NULL;
	}
	pEditor->DecRef();
	ev.Skip();
}
コード例 #8
0
ファイル: tableview.cpp プロジェクト: jacklibj/r5
void wxGridCtrl::OnLabelLeftClick(wxGridEvent& event)
{
    if (event.GetRow() != -1)
    {
        SetGridCursor(event.GetRow(),0);
    }
    event.Skip();
}
コード例 #9
0
ファイル: tableview.cpp プロジェクト: Mileslee/wxgis
void wxGridCtrl::OnLabelLeftClick(wxGridEvent& event)
{
    event.Skip();
    if (event.GetRow() != wxNOT_FOUND)
	{
        SetGridCursor(event.GetRow(),0);
    }
}
コード例 #10
0
ファイル: nwxGrid.cpp プロジェクト: HelloWilliam/osiris
void nwxGrid::OnEditCell(wxGridEvent &e)
{
  CIncrementer x(m_nInCellChange);
  int nRow = e.GetRow();
  int nCol = e.GetCol();
  SetDoNotSave(true);
  SetGridCursor(nRow,nCol);
  EnableCellEditControl(true);
}
コード例 #11
0
//---------------------------------------------------------
void CVIEW_Table_Control::On_LClick(wxGridEvent &event)
{
	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];

	//-----------------------------------------------------
	if( event.AltDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			if( event.ControlDown() )
			{
				g_pData->Open   (pRecord->asString(iField));
			}
			else
			{
				Open_Application(pRecord->asString(iField));
			}
		}
	}

	//-----------------------------------------------------
	else if( event.ControlDown() )
	{
		m_pTable->Select(pRecord, true);

		Update_Selection();
	}

	else if( event.ShiftDown() )
	{
		SelectBlock(event.GetRow(), 0, GetGridCursorRow(), GetNumberCols(), false);
	}

	else
	{
		SelectRow(event.GetRow(), false);

		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
		{
			long	lValue;

			if( DLG_Color(lValue = pRecord->asInt(iField)) )
			{
				pRecord->Set_Value(iField, lValue);

				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));

				ForceRefresh();
			}
		}
	}

	//-----------------------------------------------------
	SetGridCursor(event.GetRow(), event.GetCol());
}
コード例 #12
0
ファイル: MemoryGrid.cpp プロジェクト: Kakarot/complx
/** SelectLocation
  *
  * Shows a location on the grid
  */
void MemoryGrid::SelectLocation(unsigned short location)
{
    last_address = location;
    // Handles close to edge!
    int n_location = (location + 8 + 1) > 0xFFFF ? location : location + 8 + 1;
    SelectRow(location);
    SetGridCursor(location, 0);
    MakeCellVisible((location < 16) ? location : n_location, 0);
    Refresh();
}
コード例 #13
0
ファイル: CGridAllele.cpp プロジェクト: HelloWilliam/osiris
void CGridAllelePosCtrl::_DeleteRow(int nRow)
{
  if(!m_bReadOnly)
  {
    DeleteRows(nRow,1);
    AppendRows(1);
    SetGridReadOnly(false); // set up enabled/disabled rows
    SetGridCursor(nRow,0);
  }
  wxASSERT_MSG(
    !m_bReadOnly,
    "CGridAllelePosCtrl::_DeleteRow called on readonly table");
}
コード例 #14
0
//---------------------------------------------------------
void CActive_Attributes_Control::On_LClick(wxGridEvent &event)
{
	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pTable->Get_Record(event.GetRow());

	//-----------------------------------------------------
	if( event.AltDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			Open_Application(pRecord->asString(iField));
		}
	}

	//-----------------------------------------------------
	if( event.ControlDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			g_pData->Open   (pRecord->asString(iField));
		}
	}

	//-----------------------------------------------------
	else
	{
		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
		{
			long	lValue;

			if( DLG_Color(lValue = pRecord->asInt(iField)) )
			{
				pRecord->Set_Value(iField, lValue);

				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));

				ForceRefresh();
			}
		}
	}

	//-----------------------------------------------------
	SetGridCursor(event.GetRow(), event.GetCol());
}
コード例 #15
0
//---------------------------------------------------------
void CVIEW_Table_Control::On_RClick(wxGridEvent &event)
{
	SetGridCursor(event.GetRow(), event.GetCol());

	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];

	//-----------------------------------------------------
	if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
	{
		wxMenu	Menu;

		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_APP);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_DATA);

		PopupMenu(&Menu, event.GetPosition());
	//	PopupMenu(&Menu, GetParent()->ScreenToClient(ClientToScreen(event.GetPosition())));
	}
}
コード例 #16
0
ファイル: nwxGrid.cpp プロジェクト: HelloWilliam/osiris
void nwxGrid::OnCellChange(wxGridEvent &e)
{
  bool bDone = true; // true if done editing
  if(!m_nInCellChange)
  {
    // make sure there is no recursion
    // which seems to happen when calling SetGridCursor() below
    //
    CIncrementer x(m_nInCellChange);
    wxString sPrompt;
    int nRow = e.GetRow();
    int nCol = e.GetCol();
    if( !ValidateCell(nRow,nCol,&sPrompt)
        && !sPrompt.IsEmpty() )
    {
      sPrompt.Append(
        "\nWould you like to continue editiing?");
      wxMessageDialog dlg(this,sPrompt,"Error",
        wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
      int n = dlg.ShowModal();
      if(n == wxID_YES || n == wxID_OK)
      {
        wxGridEvent ee(e);
        ee.SetEventType(wxEVT_GRID_START_EDIT);
        SetDoNotSave(true);
        SetGridCursor(nRow,nCol);
        AddPendingEvent(ee);
        bDone = false;
      }
      else
      {
        RestoreCellValue();
      }
    }
    if(bDone)
    {
      SetDoNotSave(false);
      m_nEditorRow = -1;
      m_nEditorCol = -1;
    }
  }
  e.Skip();
}
コード例 #17
0
//---------------------------------------------------------
void CActive_Attributes_Control::On_RClick(wxGridEvent &event)
{
	SetGridCursor(event.GetRow(), event.GetCol());

	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pTable->Get_Record(event.GetRow());

	//-----------------------------------------------------
	if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
	{
		wxMenu	Menu;

		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_APP);

		wxString	Value	= GetCellValue(event.GetRow(), event.GetCol());

		if( _Get_DataSource(Value) )
		{
			CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_DATA);
		}

		PopupMenu(&Menu, event.GetPosition());
	}
}
コード例 #18
0
bool CGridAnalysis::TransferDataToGrid(
  COARfile *pFile, 
  COARsampleSort *pSort, 
  int nLabelType, 
  int nLabelTypeName, 
  wxDC *pdc)
{

  int nAMEL = -1;
  bool bError = false;

  // set up row/col count
  size_t nRowCount = pSort->GetCount();
  size_t nAlleleColCount = pFile->GetLocusCount();
  size_t nColCount = nAlleleColCount + CFrameAnalysis::FIRST_LOCUS_COLUMN + 1;
  DCholder xxx(this,pdc);
  m_nLabelSize = 0;
  m_setColChannelChange.clear();
  nwxGridBatch xBatch(this);

  bError = (!nRowCount) || (!nAlleleColCount) ||
    (!_SetGridSize((int) nRowCount,(int)nColCount));
  if(!bError)
  {
    // set up column headers
    wxString sLabel;
    wxString sLocus;
    wxString sChannel;
    SetColLabelValue(CFrameAnalysis::STATUS_COLUMN,_T(""));
    SetColLabelValue(CFrameAnalysis::ILS_COLUMN,_T("ILS"));
    SetColLabelValue(CFrameAnalysis::CHANNEL_ALERT_COLUMN,_T("Channels"));
    int nPrevChannel = 0;
    int nChannel;
    int nCol;
    size_t i;
    const COARdirectoryAlerts *pDirAlerts = pFile->GetDirectoryAlerts();

    // set up column labels

    for(i = 0, nCol = CFrameAnalysis::FIRST_LOCUS_COLUMN; i < nAlleleColCount; ++i,++nCol)
    {
      sLocus = pFile->GetLocusName(i);
      nChannel = pFile->GetChannelNr(i);
      sLabel = wxString::Format("%s-%d",sLocus.c_str(),nChannel);
      if(pDirAlerts->GetBaseLocusAlertsByLocus(sLocus) != NULL)
      {
        sLabel.Append(_T(" *"));
      }
      if(nChannel != nPrevChannel)
      {
        m_setColChannelChange.insert(nCol - 1);
        nPrevChannel = nChannel;
      }
      SetColLabelValue(nCol,sLabel);
      if(!strncmp(sLabel.MakeUpper().c_str(),"AMEL",4))
      {
        nAMEL = nCol;
      }
    }
    nCol = (int)nColCount - 1;
    SetColLabelValue(nCol,"+Ctrl");
    m_setColChannelChange.insert(nCol - 1);
    m_setColChannelChange.insert(nCol);

    UpdateGrid(pFile,pSort,nLabelType,nLabelTypeName);
    UpdateLabelSize();
    SetGridCursor(0,CFrameAnalysis::ILS_COLUMN);
    SetColLabelSize(GetRowSize(0) + 2);
  }
  return !bError;
}
コード例 #19
0
ファイル: Grid.cpp プロジェクト: ducknoir/audacity
void Grid::OnKeyDown(wxKeyEvent &event)
{
    switch (event.GetKeyCode())
    {
    case WXK_LEFT:
    case WXK_RIGHT:
    {
        int rows = GetNumberRows();
        int cols = GetNumberCols();
        int crow = GetGridCursorRow();
        int ccol = GetGridCursorCol();

        if (event.GetKeyCode() == WXK_LEFT) {
            if (crow == 0 && ccol == 0) {
                // do nothing
            }
            else if (ccol == 0) {
                SetGridCursor(crow - 1, cols - 1);
            }
            else {
                SetGridCursor(crow, ccol - 1);
            }
        }
        else {
            if (crow == rows - 1 && ccol == cols - 1) {
                // do nothing
            }
            else if (ccol == cols - 1) {
                SetGridCursor(crow + 1, 0);
            }
            else {
                SetGridCursor(crow, ccol + 1);
            }
        }

#if wxUSE_ACCESSIBILITY
        // Make sure the NEW cell is made available to the screen reader
        mAx->SetCurrentCell(GetGridCursorRow(), GetGridCursorCol());
#endif
    }
    break;

    case WXK_TAB:
    {
        int rows = GetNumberRows();
        int cols = GetNumberCols();
        int crow = GetGridCursorRow();
        int ccol = GetGridCursorCol();

        if (event.ControlDown()) {
            int flags = wxNavigationKeyEvent::FromTab |
                        ( event.ShiftDown() ?
                          wxNavigationKeyEvent::IsBackward :
                          wxNavigationKeyEvent::IsForward );
            Navigate(flags);
            return;
        }
        else if (event.ShiftDown()) {
            if (crow == 0 && ccol == 0) {
                Navigate(wxNavigationKeyEvent::FromTab | wxNavigationKeyEvent::IsBackward);
                return;
            }
            else if (ccol == 0) {
                SetGridCursor(crow - 1, cols - 1);
            }
            else {
                SetGridCursor(crow, ccol - 1);
            }
        }
        else {
            if (crow == rows - 1 && ccol == cols - 1) {
                Navigate(wxNavigationKeyEvent::FromTab | wxNavigationKeyEvent::IsForward);
                return;
            }
            else if (ccol == cols - 1) {
                SetGridCursor(crow + 1, 0);
            }
            else {
                SetGridCursor(crow, ccol + 1);
            }
        }
        MakeCellVisible(GetGridCursorRow(), GetGridCursorCol());

#if wxUSE_ACCESSIBILITY
        // Make sure the NEW cell is made available to the screen reader
        mAx->SetCurrentCell(GetGridCursorRow(), GetGridCursorCol());
#endif
    }
    break;

    case WXK_RETURN:
    case WXK_NUMPAD_ENTER:
    {
        if (!IsCellEditControlShown()) {
            wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
            wxWindow *def = tlw->GetDefaultItem();
            if (def && def->IsEnabled()) {
                wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
                                      def->GetId());
                GetParent()->GetEventHandler()->ProcessEvent(cevent);
            }
        }
        else {
            wxGrid::OnKeyDown(event);

            // This looks strange, but what it does is selects the cell when
            // enter is pressed after editing.  Without it, Jaws and Window-Eyes
            // do not speak the NEW cell contents (the one below the edited one).
            SetGridCursor(GetGridCursorRow(), GetGridCursorCol());
        }
        break;
    }

    default:
        wxGrid::OnKeyDown(event);
        break;
    }
}
コード例 #20
0
void CBOINCGridCtrl::RestoreGridCursorPosition() {
	int index = GetTable()->FindRowIndexByColValue(m_pkColumnIndex1,m_szCursorKey1,m_pkColumnIndex2,m_szCursorKey2);
	if(index >=0) {		
		SetGridCursor(index,m_cursorcol);		
	}
}
コード例 #21
0
ファイル: grid.cpp プロジェクト: antonvw/wxExtension
bool wex::grid::find_next(const std::string& text, bool forward)
{
  if (text.empty())
  {
    return false;
  }

  static bool recursive = false;
  static int start_row;
  static int end_row;
  static int init_row;
  static int start_col;
  static int end_col;

  wxString text_use = text;

  if (!find_replace_data::get()->match_case())
  {
    text_use.MakeUpper();
  }

  wxGridCellCoords grid_cursor(GetGridCursorRow(), GetGridCursorCol());

  if (forward)
  {
    init_row = 0;

    if (recursive)
    {
      start_row = init_row;
      start_col = 0;
    }
    else
    {
      start_row = grid_cursor.GetRow() + 1;
      start_col = grid_cursor.GetCol();
    }

    end_row = GetNumberRows();
    end_col = GetNumberCols();
  }
  else
  {
    init_row = GetNumberRows() - 1;

    if (recursive)
    {
      start_row = init_row;
      start_col = GetNumberCols() - 1;
    }
    else
    {
      start_row = grid_cursor.GetRow() - 1;
      start_col = grid_cursor.GetCol();
    }

    end_row = -1;
    end_col = -1;
  }
  
  if (start_col == -1)
  {
    start_col = 0;
  }

  if (start_row == -1)
  {
    start_row = 0;
  }
  
  wxGridCellCoords match;

  for (int j = start_col; j != end_col && !match; (forward ? j++: j--))
  {
    for (int i = (j == start_col ? start_row: init_row);
         i != end_row && !match;
         (forward ? i++: i--))
    {
      wxString text = GetCellValue(i, j);

      if (!find_replace_data::get()->match_case())
      {
        text.MakeUpper();
      }

      if (find_replace_data::get()->match_word())
      {
        if (text == text_use)
        {
          match = wxGridCellCoords(i, j);
        }
      }
      else
      {
        if (text.Contains(text_use))
        {
          match = wxGridCellCoords(i, j);
        }
      }
    }
  }

  if (!match)
  {
    bool result = false;
    
    frame::statustext(
      get_find_result(text, forward, recursive), std::string());
    
    if (!recursive)
    {
      recursive = true;
      result = find_next(text, forward);
      recursive = false;
    }
    
    return result;
  }
  else
  {
    recursive = false;
    SetGridCursor(match.GetRow(), match.GetCol());
    MakeCellVisible(match); // though docs say this isn't necessary, it is
    return true;
  }
}