Ejemplo n.º 1
0
void mmPayeeDialog::OnDataChanged(wxDataViewEvent& event)
{
    int row = payeeListBox_->ItemToRow(event.GetItem());
    wxVariant var;
    payeeListBox_->GetValue(var, row, event.GetColumn());
    const wxString value = var.GetString();

    auto payee = Model_Payee::instance().get(m_payee_rename);
    if (!payee || value == payee->PAYEENAME) return;

    const auto payees = Model_Payee::instance().find(Model_Payee::PAYEENAME(value));
    if (payees.empty())
    {
        if (payee)
        {
            payee->PAYEENAME = value;
            Model_Payee::instance().save(payee);
            mmWebApp::MMEX_WebApp_UpdatePayee();
            refreshRequested_ = true;
        }
    }
    else
    {
        wxMessageBox(_("Payee with same name exists")
            , _("Organize Payees: Add Payee"), wxOK | wxICON_ERROR);
    }
    fillControls();
}
void DIALOG_BOM_EDITOR::OnColumnItemToggled( wxDataViewEvent& event )
{
    wxDataViewItem item = event.GetItem();

    int row = m_columnListCtrl->ItemToRow( item );

    int col = event.GetColumn();

    if( row == wxNOT_FOUND || row < 0 || row >= (int) m_bom->ColumnCount() ) return;

    BOM_COLUMN* bomColumn = m_bom->ColumnList.GetColumnByIndex( row );

    if( nullptr == bomColumn ) return;

    bool bValue = m_columnListCtrl->GetToggleValue( row, col );

    switch ( col )
    {
    default:
        break;
    case 1: // Column visibility
        bomColumn->SetVisible( bValue );

        // Insert a new column
        if( bValue )
        {
            m_bom->AddColumn( bomColumn );
        }
        else
        {
            m_bom->RemoveColumn( bomColumn );
        }
        break;
    }
}
Ejemplo n.º 3
0
void DebuggerCallstackView::OnItemActivated(wxDataViewEvent& event)
{
    int row = m_dvListCtrl->ItemToRow(event.GetItem());

    StackEntry* entry = reinterpret_cast<StackEntry*>(m_dvListCtrl->GetItemData(event.GetItem()));
    if(entry) {
        long frame, frameLine;
        if(!entry->level.ToLong(&frame)) { frame = 0; }

        // Remove the currently selected item
        wxDataViewItem curitem = m_dvListCtrl->RowToItem(m_currLevel);
        if(curitem.IsOk()) {
            wxVariant v;
            v = ::MakeBitmapIndexText(wxString() << m_currLevel, 1);
            m_dvListCtrl->SetValue(v, m_currLevel, 0);
        }

        entry->line.ToLong(&frameLine);
        SetCurrentLevel(row);
        ManagerST::Get()->DbgSetFrame(frame, frameLine);

        // At this point m_currLevel is pointing to the new stack level
        // set it as the active one
        curitem = m_dvListCtrl->RowToItem(m_currLevel);
        if(curitem.IsOk()) {
            wxVariant v;
            v = ::MakeBitmapIndexText(wxString() << m_currLevel, 0);
            m_dvListCtrl->SetValue(v, m_currLevel, 0);
        }
    }
}
Ejemplo n.º 4
0
void LLDBThreadsView::OnItemActivated(wxDataViewEvent& event)
{
    CHECK_ITEM_RET(event.GetItem());
    LLDBThreadViewClientData* cd =
        reinterpret_cast<LLDBThreadViewClientData*>(m_dvListCtrlThreads->GetItemData(event.GetItem()));
    if(cd && !cd->GetThread().IsActive()) { m_plugin->GetLLDB()->SelectThread(cd->GetThread().GetId()); }
}
Ejemplo n.º 5
0
void OpenResourceDialog::OnEntryActivated(wxDataViewEvent& event)
{
    CHECK_ITEM_RET(event.GetItem());

    m_dataviewModel->GetClientObject(event.GetItem());
    OpenResourceDialogItemData* data =
        dynamic_cast<OpenResourceDialogItemData*>(m_dataviewModel->GetClientObject(event.GetItem()));
    if(data) { EndModal(wxID_OK); }
}
Ejemplo n.º 6
0
void NodeJSDebuggerPane::OnItemActivated(wxDataViewEvent& event)
{
    CHECK_ITEM_RET(event.GetItem());
    FrameData* cd = (FrameData*)m_dvListCtrlCallstack->GetItemData(event.GetItem());
    CHECK_PTR_RET(cd);
    NodeJSDebugger::Ptr_t debugger = NodeJSWorkspace::Get()->GetDebugger();
    if(!debugger) return;
    debugger->SelectFrame(cd->index);
}
Ejemplo n.º 7
0
void MyFrame::OnActivated( wxDataViewEvent &event )
{
    wxString title = m_music_model->GetTitle( event.GetItem() );
    wxLogMessage( "wxEVT_DATAVIEW_ITEM_ACTIVATED, Item: %s", title );

    if (m_ctrl[0]->IsExpanded( event.GetItem() ))
    {
        wxLogMessage( "Item: %s is expanded", title );
    }
}
void ImplementParentVirtualFunctionsDialog::OnValueChanged(wxDataViewEvent& event)
{
    event.Skip();
    clFunctionImplDetails *cd = dynamic_cast<clFunctionImplDetails*>( m_dataviewModel->GetClientObject(event.GetItem()) );
    wxVector<wxVariant> cols = m_dataviewModel->GetItemColumnsData(event.GetItem());
    cd->SetVisibility( cols.at(2).GetString() );
    cd->SetPrependVirtualKeyword( cols.at(3).GetBool() );
    cd->SetSelected( cols.at(0).GetBool() );
    cd->SetDoxygen( cols.at(4).GetBool() );
}
Ejemplo n.º 9
0
void MyFrame::OnDropPossible( wxDataViewEvent &event )
{
    wxDataViewItem item( event.GetItem() );

    // only allow drags for item, not containers
    if (m_music_model->IsContainer( item ) )
        event.Veto();

    if (event.GetDataFormat() != wxDF_UNICODETEXT)
        event.Veto();
}
Ejemplo n.º 10
0
void MyFrame::OnHeaderClick( wxDataViewEvent &event )
{
    // we need to skip the event to let the default behaviour of sorting by
    // this column when it is clicked to take place
    event.Skip();

    int pos = m_ctrl[0]->GetColumnPosition( event.GetDataViewColumn() );

    wxLogMessage( "wxEVT_DATAVIEW_COLUMN_HEADER_CLICK, Column position: %d", pos );
    wxLogMessage( "Column width: %d", event.GetDataViewColumn()->GetWidth() );
}
Ejemplo n.º 11
0
void GitCommitListDlg::OnSelectionChanged(wxDataViewEvent& event)
{
    wxVariant v;
    if(!event.GetItem().IsOk()) {
        return;
    }

    m_dvListCtrlCommitList->GetValue(v, m_dvListCtrlCommitList->ItemToRow(event.GetItem()), 0);
    wxString commitID = v.GetString();
    wxString command = wxString::Format(wxT("%s --no-pager show %s"), m_gitPath.c_str(), commitID.c_str());
    m_process = CreateAsyncProcess(this, command, IProcessCreateDefault, m_workingDir);
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection( wxDataViewEvent& event )
{
    if( event.GetColumn() != 0 )
        return;

    int row = m_layers->ItemToRow( event.GetItem() );
    wxVariant layerID;
    m_layers->GetValue( layerID, row, 2 );
    bool selected = m_layers->GetToggleValue( row, 0 );

    m_zonesettings.m_Layers.set( ToLAYER_ID( layerID.GetInteger() ), selected );
}
Ejemplo n.º 13
0
void MyFrame::OnStartEditing( wxDataViewEvent &event )
{
    wxString artist = m_music_model->GetArtist( event.GetItem() );
    if (artist == "Ludwig van Beethoven")
    {
        event.Veto();

        wxLogMessage( "wxEVT_DATAVIEW_ITEM_START_EDITING vetoed. Artist: %s", artist );
    }
    else
        wxLogMessage( "wxEVT_DATAVIEW_ITEM_START_EDITING not vetoed. Artist: %s", artist );

}
Ejemplo n.º 14
0
void TableSettings::OnKeyChanged(wxDataViewEvent& event)
{
    Constraint *key = reinterpret_cast<Constraint*>( m_dvKeys->GetItemData( event.GetItem() ) );
    if( key ) {
        wxVariant val;
        event.GetModel()->GetValue( val, event.GetItem(), event.GetColumn() );
        if( ! val.IsNull() ) {
            key->SetName( val.GetString() );
        }
    }

    event.Skip();
}
Ejemplo n.º 15
0
void ThreadListPanel::OnItemActivated(wxDataViewEvent& event)
{
    if(!event.GetItem().IsOk()) return;

    wxVariant v;
    long threadId;
    m_dvListCtrl->GetValue(v, m_dvListCtrl->ItemToRow(event.GetItem()), 0);
    wxString str_id = v.GetString();
    if(str_id.ToCLong(&threadId)) {
        Manager* mgr = ManagerST::Get();
        mgr->DbgSetThread(threadId);
    }
}
Ejemplo n.º 16
0
void SSHAccountManagerDlg::OnEditAccount(wxDataViewEvent& event)
{
    SSHAccountInfo *account = (SSHAccountInfo*)(m_dvListCtrlAccounts->GetItemData( event.GetItem() ));
    AddSSHAcountDlg dlg(this, *account);
    if ( dlg.ShowModal() == wxID_OK ) {
        // update the user info
        dlg.GetAccountInfo(*account);

        // update the UI
        m_dvListCtrlAccounts->GetStore()->SetValue(account->GetAccountName(), event.GetItem(), 0);
        m_dvListCtrlAccounts->GetStore()->SetValue(account->GetUsername(), event.GetItem(), 1);
        m_dvListCtrlAccounts->Refresh();
    }
}
Ejemplo n.º 17
0
void ImportFilesDialogNew::OnItemExpanding(wxDataViewEvent& event)
{
    event.Skip();
    wxDataViewItemArray children;
    if ( m_dataviewModel->GetChildren(event.GetItem(), children) ) {
        wxDataViewItem child = children.Item(0);
        ImportFilesDlgData *cd = dynamic_cast<ImportFilesDlgData*>(m_dataviewModel->GetClientObject(child));
        if ( cd && cd->IsDummy() ) {
            cd = dynamic_cast<ImportFilesDlgData*>(m_dataviewModel->GetClientObject(event.GetItem()));
            m_dataviewModel->DeleteItem( child );
            wxDir dir ( cd->GetPath() );
            DoBuildTree( event.GetItem(), dir, cd->IsChecked() );
        }
    }
}
Ejemplo n.º 18
0
void wxTreeListCtrl::SendItemEvent(wxEventType evt, wxDataViewEvent& eventDV)
{
    wxTreeListEvent eventTL(evt, this, m_model->FromDVI(eventDV.GetItem()));

    if ( !ProcessWindowEvent(eventTL) )
    {
        eventDV.Skip();
        return;
    }

    if ( !eventTL.IsAllowed() )
    {
        eventDV.Veto();
    }
}
Ejemplo n.º 19
0
void OpenWindowsPanel::OnTabActivated(wxDataViewEvent& event)
{
    event.Skip();
    CHECK_WORKSPACE_CLOSING();

    wxDataViewItem item = event.GetItem();
    CHECK_ITEM_RET(item);

    TabClientData* data = reinterpret_cast<TabClientData*>(m_dvListCtrl->GetItemData(item));
    if(data->IsFile()) {
        m_mgr->OpenFile(data->tab.filename.GetFullPath());
    } else {
        m_mgr->SelectPage(m_mgr->FindPage(data->tab.text));
    }
}
void mmCustomFieldListDialog::OnItemRightClick(wxDataViewEvent& event)
{
    wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_ANY) ;
    evt.SetEventObject( this );

    Model_CustomField::Data *field = Model_CustomField::instance().get(m_field_id);

    wxMenu* mainMenu = new wxMenu;
    if (field) mainMenu->SetTitle(field->DESCRIPTION);
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_NEW_FIELD, _("&Add ")));
    mainMenu->AppendSeparator();
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_EDIT_FIELD, _("&Edit ")));
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_DELETE_FIELD, _("&Remove ")));
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_UPDATE_FIELD, _("&Massive content update ")));
    if (!field)
    {
        mainMenu->Enable(MENU_EDIT_FIELD, false);
        mainMenu->Enable(MENU_DELETE_FIELD, false);
        mainMenu->Enable(MENU_UPDATE_FIELD, false);
    }

    PopupMenu(mainMenu);
    delete mainMenu;
    event.Skip();
}
void mmAttachmentDialog::OnItemRightClick(wxDataViewEvent& event)
{
    wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_ANY) ;
    evt.SetEventObject( this );

    Model_Attachment::Data* attachment = Model_Attachment::instance().get(m_attachment_id);

    wxMenu* mainMenu = new wxMenu;
    if (attachment) mainMenu->SetTitle(attachment->DESCRIPTION);
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_NEW_ATTACHMENT, _("&Add ")));
    mainMenu->AppendSeparator();
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_OPEN_ATTACHMENT, _("&Open ")));
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_EDIT_ATTACHMENT, _("&Edit ")));
    if (!attachment) mainMenu->Enable(MENU_EDIT_ATTACHMENT, false);
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_DELETE_ATTACHMENT, _("&Remove ")));

    //Disable buttons
    wxString AttachmentsFolder = mmex::getPathAttachment(mmAttachmentManage::InfotablePathSetting());
    if (AttachmentsFolder == wxEmptyString || !wxDirExists(AttachmentsFolder))
        mainMenu->Enable(MENU_NEW_ATTACHMENT, false);

    if (!attachment)
    {
        mainMenu->Enable(MENU_OPEN_ATTACHMENT, false);
        mainMenu->Enable(MENU_EDIT_ATTACHMENT, false);
        mainMenu->Enable(MENU_DELETE_ATTACHMENT, false);
    }

    PopupMenu(mainMenu);
    delete mainMenu;
    event.Skip();
}
Ejemplo n.º 22
0
void ImportFilesDialogNew::OnValueChanged(wxDataViewEvent& event)
{
    event.Skip();
    wxVector<wxVariant> cols = m_dataviewModel->GetItemColumnsData(event.GetItem());
    if ( cols.size() > 1 ) {
        bool isChecked = cols.at(1).GetBool();
        ImportFilesDlgData *cd = reinterpret_cast<ImportFilesDlgData*>(m_dataviewModel->GetClientObject(event.GetItem()));
        if ( cd ) {
            cd->SetIsChecked( isChecked );
            DoCheckChildren( event.GetItem(), isChecked );
        }
#ifdef __WXGTK__
        Refresh();
#endif
    }
}
Ejemplo n.º 23
0
void ProjectPanel::OnActivateItem( wxDataViewEvent& event )
{
    ProjectViewModelNode *node = static_cast< ProjectViewModelNode* >( event.GetItem().GetID() );
    if ( !node )
    {
        return;
    }

    const FilePath& path = node->GetPath().GetAbsolutePath( m_Project->a_Path.Get() );
    HELIUM_ASSERT( !path.empty() );

    if ( !path.Exists() )
    {
#pragma TODO( "Walk the user through locating the missing file." )
        wxMessageBox( wxT( "Unfortunately, the file you're trying to load does not exist.  In the future, we'll help you find and fix this reference.  For now, all we can do is apologize." ), wxT( "Nonexistent File" ), wxOK | wxICON_ERROR );
        return;
    }

    if ( path.HasExtension( TXT( "HeliumScene" ) ) )
    {
        wxGetApp().GetFrame()->CloseAllScenes();
        wxGetApp().GetFrame()->OpenScene( path );
        return;
    }

    // we've gotten to an item we don't know how to activate yet
    HELIUM_BREAK();
}
void MissionInfoEditDialog::onTitleEdited(wxDataViewEvent& ev)
{
	wxutil::TreeModel::Row row(ev.GetItem(), *_missionTitleStore);

	int titleNum = row[_missionTitleColumns.number].getInteger();

	map::DarkmodTxt::TitleList list = _darkmodTxt->getMissionTitles();

	assert(titleNum >= 0 && titleNum < static_cast<int>(list.size()));

	if (ev.GetColumn() == _missionTitleColumns.title.getColumnIndex())
	{
		list[titleNum] = static_cast<std::string>(ev.GetValue());
		_darkmodTxt->setMissionTitles(list);
	}
}
Ejemplo n.º 25
0
void wxTreeListCtrl::SendColumnEvent(wxEventType evt, wxDataViewEvent& eventDV)
{
    wxTreeListEvent eventTL(evt, this, wxTreeListItem());
    eventTL.SetColumn(eventDV.GetColumn());

    if ( !ProcessWindowEvent(eventTL) )
    {
        eventDV.Skip();
        return;
    }

    if ( !eventTL.IsAllowed() )
    {
        eventDV.Veto();
    }
}
Ejemplo n.º 26
0
void mmPayeeDialog::OnItemRightClick(wxDataViewEvent& event)
{
    wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_ANY) ;
    evt.SetEventObject(this);

    Model_Payee::Data* payee = Model_Payee::instance().get(m_payee_id);

    wxMenu* mainMenu = new wxMenu;
    if (payee) mainMenu->SetTitle(payee->PAYEENAME);
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_DEFINE_CATEGORY, _("Define Default Category")));
    if (!payee) mainMenu->Enable(MENU_DEFINE_CATEGORY, false);
    mainMenu->AppendSeparator();

    mainMenu->Append(new wxMenuItem(mainMenu, MENU_NEW_PAYEE, _("&Add ")));
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_EDIT_PAYEE, _("&Edit ")));
    if (!payee) mainMenu->Enable(MENU_EDIT_PAYEE, false);
    mainMenu->Append(new wxMenuItem(mainMenu, MENU_DELETE_PAYEE, _("&Remove ")));
    if (!payee || Model_Payee::is_used(m_payee_id)) mainMenu->Enable(MENU_DELETE_PAYEE, false);
    mainMenu->AppendSeparator();

    mainMenu->Append(new wxMenuItem(mainMenu, MENU_ORGANIZE_ATTACHMENTS, _("&Organize Attachments")));
    if (!payee) mainMenu->Enable(MENU_ORGANIZE_ATTACHMENTS, false);
    mainMenu->AppendSeparator();

    mainMenu->Append(new wxMenuItem(mainMenu, MENU_RELOCATE_PAYEE, _("Relocate Payee")));
    //SetToolTip(_("Change all transactions using one Payee to another Payee"));
    if (!payee) mainMenu->Enable(MENU_RELOCATE_PAYEE, false);

    PopupMenu(mainMenu);
    delete mainMenu;
    event.Skip();
}
Ejemplo n.º 27
0
void CscopeTab::OnItemSelected(wxDataViewEvent& event)
{
    // Expand parent items on selection
    CscopeTabClientData *data = dynamic_cast<CscopeTabClientData*>(m_dataviewModel->GetClientObject(event.GetItem()));
    if ( !data ) {
        // Parent item, expand it
        if ( m_dataview->IsExpanded( event.GetItem() ) ) {
            m_dataview->Collapse( event.GetItem() );
        } else {
            m_dataview->Expand( event.GetItem() );
        }
        
    } else {
        event.Skip();
    }
}
Ejemplo n.º 28
0
void mmMainCurrencyDialog::OnListItemSelected(wxDataViewEvent& event)
{
    wxDataViewItem item = event.GetItem();
    selectedIndex_ = currencyListBox_->ItemToRow(item);

    wxString currName;
    if (selectedIndex_ >= 0)
    {
        currencyID_ = (int)currencyListBox_->GetItemData(item);
        Model_Currency::Data* currency = Model_Currency::instance().get(currencyID_);
        if (currency)
        {
            currName = currency->CURRENCYNAME;
            itemButtonEdit_->Enable();
        }
    }
    if (!bEnableSelect_)    // prevent user deleting currencies when editing accounts.
    {
        int baseCurrencyID = Option::instance().BaseCurrency();
        Model_Currency::Data* currency = Model_Currency::instance().get(currencyID_);
        if (currency)
        {
            itemButtonDelete_->Enable(!Model_Account::is_used(currency) && currencyID_ != baseCurrencyID);
            currName = currency->CURRENCYNAME;
        }
    }

    historyStaticBox_->SetLabel(_("Currency History Options: ") + currName + " ");

    valueDatePicker_->SetValue(wxDateTime::Today());
    valueTextBox_->SetValue(wxEmptyString);
    ShowCurrencyHistory();
}
void mmAttachmentDialog::OnListItemSelected(wxDataViewEvent& event)
{
    wxDataViewItem item = event.GetItem();
    int selected_index = attachmentListBox_->ItemToRow(item);

    if (selected_index >= 0)
        m_attachment_id = static_cast<int>(attachmentListBox_->GetItemData(item));
}
Ejemplo n.º 30
0
void PHPDebugPane::OnBreakpointItemActivated(wxDataViewEvent& event)
{
    XDebugBreakpoint bp = GetBreakpoint(event.GetItem());
    PHPEvent eventOpenFile(wxEVT_PHP_BREAKPOINT_ITEM_ACTIVATED);
    eventOpenFile.SetLineNumber(bp.GetLine());
    eventOpenFile.SetFileName(bp.GetFileName());
    EventNotifier::Get()->AddPendingEvent(eventOpenFile);
}