예제 #1
1
HousePalettePanel::HousePalettePanel(wxWindow* parent, wxWindowID id) :
	PalettePanel(parent, id),
	map(nullptr),
	do_resize_on_display(true),
	fix_size_timer(this, PALETTE_LAYOUT_FIX_TIMER)
{
	wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL);
	wxSizer* tmpsizer;

	wxSizer* sidesizer = newd wxStaticBoxSizer(wxVERTICAL, this, wxT("Houses"));
	town_choice = newd wxChoice(this, PALETTE_HOUSE_TOWN_CHOICE, wxDefaultPosition, wxDefaultSize, (int)0, (const wxString*)nullptr);
	sidesizer->Add(town_choice, 0, wxEXPAND);

	house_list = newd wxListBox(this, PALETTE_HOUSE_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_SORT);
	sidesizer->Add(house_list, 1, wxEXPAND);

	tmpsizer = newd wxBoxSizer(wxHORIZONTAL);
	tmpsizer->Add(add_house_button = newd wxButton(this, PALETTE_HOUSE_ADD_HOUSE, wxT("Add"), wxDefaultPosition, wxSize(50, -1)), wxSizerFlags(1).Right());
	tmpsizer->Add(edit_house_button = newd wxButton(this, PALETTE_HOUSE_EDIT_HOUSE, wxT("Edit"), wxDefaultPosition, wxSize(50, -1)), wxSizerFlags(1).Right());
	tmpsizer->Add(remove_house_button = newd wxButton(this, PALETTE_HOUSE_REMOVE_HOUSE, wxT("Remove"), wxDefaultPosition, wxSize(70, -1)), wxSizerFlags(1).Right());
	sidesizer->Add(tmpsizer, wxSizerFlags(0).Right());

	topsizer->Add(sidesizer, 1, wxEXPAND);

	// Temple position
	sidesizer = newd wxStaticBoxSizer(newd wxStaticBox(this, wxID_ANY, wxT("Brushes"), wxDefaultPosition, wxSize(150, 200)), wxVERTICAL);

	//sidesizer->Add(180, 1, wxEXPAND);

	tmpsizer = newd wxBoxSizer(wxHORIZONTAL);
	house_brush_button = newd wxToggleButton(this, PALETTE_HOUSE_BRUSH_BUTTON, wxT("House tiles"));
	tmpsizer->Add(house_brush_button);
	sidesizer->Add(tmpsizer, wxSizerFlags(1).Center());

	tmpsizer = newd wxBoxSizer(wxHORIZONTAL);
	select_position_button = newd wxToggleButton(this, PALETTE_HOUSE_SELECT_EXIT_BUTTON, wxT("Select Exit"));
	tmpsizer->Add(select_position_button);
	sidesizer->Add(tmpsizer, wxSizerFlags(1).Center());

	topsizer->Add(sidesizer, 0, wxEXPAND);

	SetSizerAndFit(topsizer);
}
예제 #2
0
BrowseTileWindow::BrowseTileWindow(wxWindow* parent, const Map* map, Tile* tile, wxPoint position /* = wxDefaultPosition */) :
    wxDialog(parent, wxID_ANY, "Browse Field", position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER)
{
    wxSizer* sizer = newd wxBoxSizer(wxVERTICAL);
    item_list = newd BrowseTileListBox(this, wxID_ANY, tile);
    sizer->Add(item_list, wxSizerFlags(1).Expand());

    wxString pos;
    pos << wxT("x=") << tile->getX() << wxT(",  y=") << tile->getY() << wxT(",  z=") << tile->getZ();

    wxSizer* infoSizer = newd wxBoxSizer(wxVERTICAL);
    infoSizer->Add(newd wxButton(this, wxID_REMOVE, wxT("Delete")), wxSizerFlags(0).Left());
    infoSizer->AddSpacer(5);
    infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("Position:  ") + pos), wxSizerFlags(0).Left());
    infoSizer->Add(item_count_txt = newd wxStaticText(this, wxID_ANY, wxT("Item count:  ") + i2ws(item_list->GetItemCount())), wxSizerFlags(0).Left());
    infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("Protection zone:  ") + b2yn(tile->isPZ())), wxSizerFlags(0).Left());
    infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("No PvP:  ") + b2yn(tile->getMapFlags() & TILESTATE_NOPVP)), wxSizerFlags(0).Left());
    infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("No logout:  ") + b2yn(tile->getMapFlags() & TILESTATE_NOLOGOUT)), wxSizerFlags(0).Left());
    infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("PvP zone:  ") + b2yn(tile->getMapFlags() & TILESTATE_PVPZONE)), wxSizerFlags(0).Left());
    infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("House:  ") + b2yn(tile->isHouseTile())), wxSizerFlags(0).Left());

    sizer->Add(infoSizer, wxSizerFlags(0).Left().DoubleBorder());

    // OK/Cancel buttons
    wxSizer* btnSizer = newd wxBoxSizer(wxHORIZONTAL);
    btnSizer->Add(newd wxButton(this, wxID_OK, wxT("OK")), wxSizerFlags(0).Center());
    btnSizer->Add(newd wxButton(this, wxID_CANCEL, wxT("Cancel")), wxSizerFlags(0).Center());
    sizer->Add(btnSizer, wxSizerFlags(0).Center().DoubleBorder());

    SetSizerAndFit(sizer);
}
예제 #3
0
파일: preferences.cpp 프로젝트: TheSumm/rme
PreferencesWindow::PreferencesWindow(wxWindow* parent) : wxDialog(parent, wxID_ANY, "Preferences", wxDefaultPosition, wxSize(400, 400), wxCAPTION | wxCLOSE_BOX)
{
	wxSizer* sizer = newd wxBoxSizer(wxVERTICAL);

	book = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_TOP);
	//book->SetPadding(4);

	book->AddPage(CreateGeneralPage(), "General", true);
	book->AddPage(CreateEditorPage(), "Editor");
	book->AddPage(CreateGraphicsPage(), "Graphics");
	book->AddPage(CreateUIPage(), "Interface");
	book->AddPage(CreateClientPage(), "Client Version");

	sizer->Add(book, 1, wxEXPAND | wxALL, 10);

	wxSizer* subsizer = newd wxBoxSizer(wxHORIZONTAL);
	subsizer->Add(newd wxButton(this, wxID_OK, "OK"), wxSizerFlags(1).Center());
	subsizer->Add(newd wxButton(this, wxID_CANCEL, "Cancel"), wxSizerFlags(1).Center());
	subsizer->Add(newd wxButton(this, wxID_APPLY, "Apply"), wxSizerFlags(1).Center());
	sizer->Add(subsizer, 0, wxCENTER | wxLEFT | wxBOTTOM | wxRIGHT, 10);

	SetSizerAndFit(sizer);
	Centre(wxBOTH);
	// FindWindowById(PANE_ADVANCED_GRAPHICS, this)->GetParent()->Fit();
}
예제 #4
0
//==============================================================================
browsers::GDSbrowser::GDSbrowser(wxWindow *parent, wxWindowID id, 
                        const wxPoint& pos , 
                        const wxSize& size ,
                        long style ):wxPanel(parent, id, pos, size, style)
{
   wxBoxSizer *thesizer = DEBUG_NEW wxBoxSizer( wxVERTICAL );
      
   wxBoxSizer *sizer1 = DEBUG_NEW wxBoxSizer( wxHORIZONTAL );
   _hierButton = DEBUG_NEW wxButton( this, BT_CELLS_HIER2, wxT("Hier") );
   //Set bold font for _hierButton
   wxFont font = _hierButton->GetFont();
   font.SetWeight(wxFONTWEIGHT_BOLD);
   _hierButton->SetFont(font);

   _flatButton = DEBUG_NEW wxButton( this, BT_CELLS_FLAT2, wxT("Flat") );

   sizer1->Add(_hierButton, 1, wxEXPAND|wxBOTTOM, 3);
   sizer1->Add(_flatButton, 1, wxEXPAND|wxBOTTOM, 3);
   
   fCellBrowser = DEBUG_NEW GDSCellBrowser(this, tui::ID_GDS_CELLTREE_F, pos, size, style);
   
   hCellBrowser = DEBUG_NEW GDSCellBrowser(this, tui::ID_GDS_CELLTREE_H, pos, size, style);
   
   thesizer->Add(hCellBrowser, 1, wxEXPAND | wxBOTTOM);
   thesizer->Add(fCellBrowser, 1, wxEXPAND | wxBOTTOM);
   fCellBrowser->Hide();
   thesizer->Add(sizer1, 0, wxEXPAND | wxALL);

   SetSizerAndFit(thesizer);
   thesizer->SetSizeHints( this );
}
예제 #5
0
//====================================================================
browsers::layerbrowser::layerbrowser(wxWindow* parent, wxWindowID id) :
                                                               wxPanel(parent, id) {
   wxBoxSizer *thesizer = DEBUG_NEW wxBoxSizer( wxVERTICAL );
   //   
   wxString action[] = { _T("Hide"), _T("View"),  _T("Lock"),  _T("Unlock") };
   wxBoxSizer *sizer1 = DEBUG_NEW wxBoxSizer( wxHORIZONTAL );
   action_select = DEBUG_NEW wxChoice(this, BT_LAYER_ACTION, wxDefaultPosition,
                                                       wxDefaultSize, 4, action);
   action_select->SetSelection(0);
   sizer1->Add(action_select, 1, wxEXPAND, 3);
   sizer1->Add(DEBUG_NEW wxButton( this, BT_LAYER_DO, wxT("Selected") ), 1, wxEXPAND, 3);
   thesizer->Add(sizer1, 0, wxEXPAND | wxALL);
   //
   _layerlist = DEBUG_NEW topedlay_list(this, tui::ID_TPD_LAYERS);
   thesizer->Add(_layerlist,1, wxEXPAND | wxALL | wxALIGN_TOP ,3);
   //
   wxString actionwild[] = { _T("All"), _T("None")};
   wxBoxSizer *sizer3 = DEBUG_NEW wxBoxSizer( wxHORIZONTAL );
   action_wild = DEBUG_NEW wxChoice(this, BT_LAYER_ACTIONWILD, wxDefaultPosition,
                                                         wxDefaultSize, 2, actionwild);
   action_wild->SetSelection(0);
   sizer3->Add(DEBUG_NEW wxButton( this, BT_LAYER_SELECTWILD, wxT("Select") ), 1, wxEXPAND, 3);
   sizer3->Add(action_wild, 1, wxEXPAND, 3);
   thesizer->Add(sizer3, 0, wxEXPAND | wxALL);
   //
   SetSizerAndFit(thesizer);
   thesizer->SetSizeHints( this );
   //
}
예제 #6
0
ServerParamDlg::ServerParamDlg(wxWindow* pParent) : wxDialog(pParent, wxID_ANY, wxString(wxT("Server param Config")), wxDefaultPosition, wxSize(800, 600), wxDEFAULT_DIALOG_STYLE|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER)
{
	wxBoxSizer* pSizer2 = ZION_NEW wxBoxSizer(wxHORIZONTAL);
	pSizer2->AddStretchSpacer();
	pSizer2->Add(ZION_NEW wxButton(this, ID_NEW_LINE, wxT("New")), 0, wxALIGN_RIGHT | wxALL, 5);
	pSizer2->Add(ZION_NEW wxButton(this, ID_DELETE_LINE, wxT("Delete")), 0, wxALIGN_RIGHT | wxALL, 5);

	pSizer2->Add(ZION_NEW wxButton(this, wxID_OK, wxT("Save")), 0, wxALIGN_RIGHT | wxALL, 5);
	pSizer2->Add(ZION_NEW wxButton(this, wxID_CANCEL, wxT("Cancel")), 0, wxALIGN_RIGHT | wxALL, 5);

	wxBoxSizer* pSizer1 = ZION_NEW wxBoxSizer(wxVERTICAL);
	m_pPropGrid = ZION_NEW wxPropertyGrid(this, ID_PROPERTY_GRID, wxDefaultPosition, wxDefaultSize, 
            wxPG_AUTO_SORT | wxPG_SPLITTER_AUTO_CENTER | wxPG_DEFAULT_STYLE );
	
	Zion::Map<Zion::String, Zion::String> params = Zion::CClientApp::GetDefault()->GetParams();
	Zion::Map<Zion::String, Zion::String>::iterator it = params.begin();

	for(int i = 0; it != params.end(); ++it, ++i)
	{
		wxPGProperty* propGrid = ZION_NEW wxStringProperty(wxString::FromUTF8(it->first.c_str()), wxPG_LABEL, wxString::FromUTF8(it->second.c_str()));
		m_pPropGrid->Append(propGrid);
	}	
	
	pSizer1->Add(m_pPropGrid, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
	pSizer1->Add(pSizer2, 0, wxGROW|wxALIGN_BOTTOM);
	SetSizer(pSizer1);
}
예제 #7
0
ExtensionsDialog::ExtensionsDialog(wxWindow* parent) :
	wxDialog(parent, wxID_ANY, wxT("Extensions"), wxDefaultPosition, wxSize(600, 500), wxRESIZE_BORDER | wxCAPTION)
{
	wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);

	wxHtmlWindow* htmlWindow = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(550, 400));
	htmlWindow->SetPage(HTML());
	topSizer->Add(htmlWindow, wxSizerFlags(1).DoubleBorder().Expand());

	wxSizer* buttonSizer = newd wxBoxSizer(wxHORIZONTAL);
	buttonSizer->Add(newd wxButton(this, wxID_OK, wxT("OK")), wxSizerFlags(1).Center());
	buttonSizer->Add(newd wxButton(this, EXTENSIONS_OPEN_FOLDER_BUTTON, wxT("Open Extensions Folder")), wxSizerFlags(1).Center());
	topSizer->Add(buttonSizer, 0, wxCENTER | wxLEFT | wxRIGHT | wxBOTTOM, 20);

	SetSizerAndFit(topSizer);
}
예제 #8
0
//---------------------------------------------------------------------------------------
void WizardMetronomePage::CreateControls()
{
    wxBoxSizer* itemBoxSizer35 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    SetSizer(itemBoxSizer35);

    wxBoxSizer* itemBoxSizer36 = LENMUS_NEW wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer35->Add(itemBoxSizer36, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxStaticText* itemStaticText37 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Metronome channel and sounds"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText37->SetFont(wxFont(14, wxSWISS, wxNORMAL, wxBOLD, false, "Arial"));
    itemBoxSizer36->Add(itemStaticText37, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);

    wxBoxSizer* itemBoxSizer38 = LENMUS_NEW wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer35->Add(itemBoxSizer38, 1, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer39 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    itemBoxSizer38->Add(itemBoxSizer39, 1, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText40 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Channels 10 and 16 are specialized in percussion sounds. So it is recommended to choose one of these (it doesn't matter wich one)."), wxDefaultPosition, wxSize(250, -1), 0 );
    itemBoxSizer39->Add(itemStaticText40, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);

    wxStaticText* itemStaticText41 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("To better identify the first beat of each measure it is possible to assign a different sound to it. But you can also choose the same sound for both, the first beat and the others."), wxDefaultPosition, wxSize(250, -1), 0 );
    itemBoxSizer39->Add(itemStaticText41, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);

    wxStaticLine* itemStaticLine42 = LENMUS_NEW wxStaticLine( this, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
    itemBoxSizer38->Add(itemStaticLine42, 0, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer43 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    itemBoxSizer38->Add(itemBoxSizer43, 1, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText44 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Channel:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer43->Add(itemStaticText44, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    wxString* m_pMtrChannelComboStrings = NULL;
    m_pMtrChannelCombo = LENMUS_NEW wxComboBox( this, ID_COMBO_MTR_CHANNEL, "", wxDefaultPosition, wxSize(70, -1), 0, m_pMtrChannelComboStrings, wxCB_READONLY );
    itemBoxSizer43->Add(m_pMtrChannelCombo, 0, wxALIGN_LEFT|wxALL, 5);

    wxBoxSizer* itemBoxSizer46 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    itemBoxSizer43->Add(itemBoxSizer46, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxStaticText* itemStaticText47 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Sound for first beat of each measure:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer43->Add(itemStaticText47, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    wxString* m_pMtrInstr1ComboStrings = NULL;
    m_pMtrInstr1Combo = LENMUS_NEW wxComboBox( this, ID_COMBO_MTR_INSTR1, "", wxDefaultPosition, wxSize(250, -1), 0, m_pMtrInstr1ComboStrings, wxCB_READONLY );
    itemBoxSizer43->Add(m_pMtrInstr1Combo, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxStaticText* itemStaticText49 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Sound for other beats of each measure:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer43->Add(itemStaticText49, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    wxString* m_pMtrInstr2ComboStrings = NULL;
    m_pMtrInstr2Combo = LENMUS_NEW wxComboBox( this, ID_COMBO_MTR_INSTR2, "", wxDefaultPosition, wxSize(250, -1), 0, m_pMtrInstr2ComboStrings, wxCB_READONLY );
    itemBoxSizer43->Add(m_pMtrInstr2Combo, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxButton* itemButton51 = LENMUS_NEW wxButton( this, ID_BUTTON, _("Test sound"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer43->Add(itemButton51, 0, wxALIGN_LEFT|wxALL, 5);

}
예제 #9
0
EditHouseDialog::EditHouseDialog(wxWindow* parent, Map* map, House* house) :
	wxDialog(parent, wxID_ANY, wxT("House"), wxDefaultPosition, wxSize(250,160)),
	map(map),
	what_house(house)
{
	ASSERT(map);
	ASSERT(house);

	// Create topsizer
	wxSizer* sizer = newd wxBoxSizer(wxVERTICAL);
	wxSizer* tmpsizer;

	house_name = wxstr(house->name);
	house_id = i2ws(house->id);
	house_rent = i2ws(house->rent);

	// House options
	tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, wxT("Name"));
	name_field = newd wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(230,20), 0, wxTextValidator(wxFILTER_ASCII, &house_name));
	tmpsizer->Add(name_field);
 
	sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20));

	tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, wxT("Rent / ID"));
	rent_field = newd wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(160,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_rent));
	tmpsizer->Add(rent_field);
	id_field = newd wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(70,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_id));
	id_field->Enable(false);
	tmpsizer->Add(id_field);
	sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20));
	
	// House options
	guildhall_field = newd wxCheckBox(this, wxID_ANY, wxT("Guildhall"), wxDefaultPosition);
 
	sizer->Add(guildhall_field, wxSizerFlags().Border(wxRIGHT | wxLEFT | wxBOTTOM, 20));
	guildhall_field->SetValue(house->guildhall);

	// OK/Cancel buttons
	tmpsizer = newd wxBoxSizer(wxHORIZONTAL);
	tmpsizer->Add(newd wxButton(this, wxID_OK, wxT("OK")), wxSizerFlags(1).Center());
	tmpsizer->Add(newd wxButton(this, wxID_CANCEL, wxT("Cancel")), wxSizerFlags(1).Center());
	sizer->Add(tmpsizer, wxSizerFlags(1).Center().Border(wxRIGHT | wxLEFT | wxBOTTOM, 20));

	SetSizerAndFit(sizer);
}
예제 #10
0
//---------------------------------------------------------------------------------------
void WizardInstrumentsPage::CreateControls()
{
    wxBoxSizer* itemBoxSizer17 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    SetSizer(itemBoxSizer17);

    wxBoxSizer* itemBoxSizer18 = LENMUS_NEW wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer17->Add(itemBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxStaticText* itemStaticText19 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Voice channel and instrument"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText19->SetFont(wxFont(14, wxSWISS, wxNORMAL, wxBOLD, false, "Arial"));
    itemBoxSizer18->Add(itemStaticText19, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);

    wxBoxSizer* itemBoxSizer20 = LENMUS_NEW wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer17->Add(itemBoxSizer20, 1, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer21 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    itemBoxSizer20->Add(itemBoxSizer21, 1, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText22 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Channels 10 and 16 are specialized in percussion sounds. So it is recommended to choose any other channel (it doesn't matter wich one)."), wxDefaultPosition, wxSize(250, -1), 0 );
    itemBoxSizer21->Add(itemStaticText22, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);

    wxStaticText* itemStaticText23 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("To facilitate access to the instruments they are grouped into sections. First choose a section and then choose the desired instrument."), wxDefaultPosition, wxSize(250, -1), 0 );
    itemBoxSizer21->Add(itemStaticText23, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);

    wxStaticLine* itemStaticLine24 = LENMUS_NEW wxStaticLine( this, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
    itemBoxSizer20->Add(itemStaticLine24, 0, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer25 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    itemBoxSizer20->Add(itemBoxSizer25, 1, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText26 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Channel:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer25->Add(itemStaticText26, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    wxString* m_pVoiceChannelComboStrings = NULL;
    m_pVoiceChannelCombo = LENMUS_NEW wxComboBox( this, ID_COMBO_CHANNEL, "", wxDefaultPosition, wxSize(70, -1), 0, m_pVoiceChannelComboStrings, wxCB_READONLY );
    itemBoxSizer25->Add(m_pVoiceChannelCombo, 0, wxALIGN_LEFT|wxALL, 5);

    wxBoxSizer* itemBoxSizer28 = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    itemBoxSizer25->Add(itemBoxSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxStaticText* itemStaticText29 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Section:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer25->Add(itemStaticText29, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    wxString* m_pSectComboStrings = NULL;
    m_pSectCombo = LENMUS_NEW wxComboBox( this, ID_COMBO_SECTION, "", wxDefaultPosition, wxSize(250, -1), 0, m_pSectComboStrings, wxCB_READONLY );
    itemBoxSizer25->Add(m_pSectCombo, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxStaticText* itemStaticText31 = LENMUS_NEW wxStaticText( this, wxID_STATIC, _("Instrument:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer25->Add(itemStaticText31, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    wxString* m_pInstrComboStrings = NULL;
    m_pInstrCombo = LENMUS_NEW wxComboBox( this, ID_COMBO_INSTRUMENT, "", wxDefaultPosition, wxSize(250, -1), 0, m_pInstrComboStrings, wxCB_READONLY );
    itemBoxSizer25->Add(m_pInstrCombo, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);

    wxButton* itemButton33 = LENMUS_NEW wxButton( this, ID_BUTTON_TEST_SOUND, _("Test sound"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer25->Add(itemButton33, 0, wxALIGN_LEFT|wxALL, 5);
}
예제 #11
0
//==============================================================================
browsers::TDTbrowser::TDTbrowser(wxWindow *parent, wxWindowID id, 
   const wxPoint& pos, const wxSize& size, long style) : 
                                       wxPanel(parent, id, pos, size)
                                          //,
                                       //style | wxTR_FULL_ROW_HIGHLIGHT) 
{
   wxBoxSizer *thesizer = DEBUG_NEW wxBoxSizer( wxVERTICAL );
      
   wxBoxSizer *sizer1 = DEBUG_NEW wxBoxSizer( wxHORIZONTAL );
   
   _hierButton = DEBUG_NEW wxButton( this, BT_CELLS_HIER, wxT("Hier") );
   //Set bold font for _hierButton
   wxFont font = _hierButton->GetFont();
   font.SetWeight(wxFONTWEIGHT_BOLD);
   _hierButton->SetFont(font);

   _flatButton = DEBUG_NEW wxButton( this, BT_CELLS_FLAT, wxT("Flat") );
   sizer1->Add(_hierButton, 1, wxEXPAND|wxBOTTOM, 3);
   sizer1->Add(_flatButton, 1, wxEXPAND|wxBOTTOM, 3);
   fCellBrowser = DEBUG_NEW CellBrowser(this, tui::ID_TPD_CELLTREE_F,pos, size, style);
   
   hCellBrowser = DEBUG_NEW CellBrowser(this, tui::ID_TPD_CELLTREE_H, pos, size, style);
   
   thesizer->Add(hCellBrowser, 1, wxEXPAND | wxBOTTOM);
   thesizer->Add(fCellBrowser, 1, wxEXPAND | wxBOTTOM);
   fCellBrowser->Hide();
   thesizer->Add(sizer1, 0, wxEXPAND | wxALL);

   _imageList = DEBUG_NEW wxImageList(16, 16, TRUE);
#ifdef __WXMSW__
/*TODO : Under windows - resource loading*/
//    m_imageListNormal->Add( wxIcon(_T("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) );
//
#else
    _imageList->Add( wxIcon( cell_normal   ) );
    _imageList->Add( wxIcon( cell_expanded ) );
#endif
   hCellBrowser->SetImageList(_imageList);
//   _llfont_bold.SetWeight(wxBOLD);
//   _llfont_normal.SetWeight(wxNORMAL);
   SetSizerAndFit(thesizer);
   thesizer->SetSizeHints( this );

}
예제 #12
0
wxWindow* PropertiesWindow::createAttributesPanel(wxWindow* parent)
{
	wxPanel* panel = newd wxPanel(parent, wxID_ANY);
	wxSizer* topSizer = newd wxBoxSizer(wxVERTICAL);

	attributesGrid = newd wxGrid(panel, ITEM_PROPERTIES_ADVANCED_TAB, wxDefaultPosition, wxSize(-1, 160));
	topSizer->Add(attributesGrid, wxSizerFlags(1).Expand());

	wxFont time_font(*wxSWISS_FONT);
	attributesGrid->SetDefaultCellFont(time_font);
	attributesGrid->CreateGrid(0, 3);
	attributesGrid->DisableDragRowSize();
	attributesGrid->DisableDragColSize();
	attributesGrid->SetSelectionMode(wxGrid::wxGridSelectRows);
	attributesGrid->SetRowLabelSize(0);
	//log->SetColLabelSize(0);
	//log->EnableGridLines(false);
	attributesGrid->EnableEditing(true);

	attributesGrid->SetColLabelValue(0, "Key");
	attributesGrid->SetColSize(0, 100);
	attributesGrid->SetColLabelValue(1, "Type");
	attributesGrid->SetColSize(1, 80);
	attributesGrid->SetColLabelValue(2, "Value");
	attributesGrid->SetColSize(2, 410);

	// contents
	ItemAttributeMap attrs = edit_item->getAttributes();
	attributesGrid->AppendRows(attrs.size());
	int i = 0;
	for(ItemAttributeMap::iterator aiter = attrs.begin(); aiter != attrs.end(); ++aiter, ++i)
		SetGridValue(attributesGrid, i, aiter->first, aiter->second);

	wxSizer* optSizer = newd wxBoxSizer(wxHORIZONTAL);
	optSizer->Add(newd wxButton(panel, ITEM_PROPERTIES_ADD_ATTRIBUTE, "Add Attribute"), wxSizerFlags(0).Center());
	optSizer->Add(newd wxButton(panel, ITEM_PROPERTIES_REMOVE_ATTRIBUTE, "Remove Attribute"), wxSizerFlags(0).Center());
	topSizer->Add(optSizer, wxSizerFlags(0).Center().DoubleBorder());

	panel->SetSizer(topSizer);

	return panel;
}
예제 #13
0
browsers::LayerBrowser::LayerBrowser(wxWindow* parent, wxWindowID id) 
   :wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize),
   _layerPanel(NULL),
   _thesizer(NULL)
{
   _thesizer = DEBUG_NEW wxBoxSizer(wxVERTICAL);

   wxBoxSizer *sizer1 = DEBUG_NEW wxBoxSizer(wxHORIZONTAL);
   sizer1->Add(DEBUG_NEW wxButton(this, BT_LAYER_SHOW_ALL, wxT("Show All")), 1, wxTOP, 3);
   sizer1->Add(DEBUG_NEW wxButton(this, BT_LAYER_HIDE_ALL, wxT("Hide All")), 1, wxTOP, 3);
   _thesizer->Add(sizer1, 0, wxTOP);

   wxBoxSizer *sizer2 = DEBUG_NEW wxBoxSizer(wxHORIZONTAL);
   sizer2->Add(DEBUG_NEW wxButton(this, BT_LAYER_LOCK_ALL, wxT("Lock All")), 1, wxTOP, 3);
   sizer2->Add(DEBUG_NEW wxButton(this, BT_LAYER_UNLOCK_ALL, wxT("Unlock All")), 1, wxTOP, 3);
   _thesizer->Add(sizer2, 0, wxTOP);

   _layerPanel = DEBUG_NEW LayerPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
   _thesizer->Add(_layerPanel, 3, wxEXPAND|wxALL);
   SetSizerAndFit(_thesizer);
   _thesizer->SetSizeHints( this );
}
예제 #14
0
PropertiesWindow::PropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile_parent, Item* item, wxPoint pos) :
	ObjectPropertiesWindowBase(parent, "Item Properties", map, tile_parent, item, pos),
	currentPanel(nullptr)
{
	ASSERT(edit_item);
	notebook = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(600, 300));

	notebook->AddPage(createGeneralPanel(notebook), wxT("Simple"), true);
	if (dynamic_cast<Container*>(item)) {
		notebook->AddPage(createContainerPanel(notebook), wxT("Contents"));
	}
	notebook->AddPage(createAttributesPanel(notebook), wxT("Advanced"));

	wxSizer* topSizer = newd wxBoxSizer(wxVERTICAL);
	topSizer->Add(notebook, wxSizerFlags(1).DoubleBorder());

	wxSizer* optSizer = newd wxBoxSizer(wxHORIZONTAL);
	optSizer->Add(newd wxButton(this, wxID_OK, wxT("OK")), wxSizerFlags(0).Center());
	optSizer->Add(newd wxButton(this, wxID_CANCEL, wxT("Cancel")), wxSizerFlags(0).Center());
	topSizer->Add(optSizer, wxSizerFlags(0).Center().DoubleBorder());

	SetSizerAndFit(topSizer);
}
예제 #15
0
CRefSelDlg::CRefSelDlg(wxWindow* pParent, wxString wxRefType) : wxDialog(pParent, wxID_ANY, wxT("Ref Select"), wxDefaultPosition, wxSize(600, 300), wxDEFAULT_DIALOG_STYLE|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER)
{
	m_pTextCtrl = ZION_NEW wxTextCtrl(this, ID_REF_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT);

	wxBoxSizer* pSizer2 = ZION_NEW wxBoxSizer(wxHORIZONTAL);
	pSizer2->AddStretchSpacer();
	pSizer2->Add(ZION_NEW wxButton(this, wxID_OK, wxT("Confirm")), 0, wxALIGN_RIGHT | wxALL, 5);
	pSizer2->Add(ZION_NEW wxButton(this, wxID_CANCEL, wxT("Cancel")), 0, wxALIGN_RIGHT | wxALL, 5);

	wxBoxSizer* pSizer1 = ZION_NEW wxBoxSizer(wxVERTICAL);
	pSizer1->Add(m_pTextCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
	m_pUUIDList = ZION_NEW wxListCtrl(this, ID_REF_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);
	pSizer1->Add(m_pUUIDList, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);

	pSizer1->Add(pSizer2, 0, wxGROW|wxALIGN_CENTER_VERTICAL);
	SetSizer(pSizer1);

	m_strRefType = wxRefType;
	m_pUUIDList->InsertColumn(0, wxT("Name"), 0, 120);
	m_pUUIDList->InsertColumn(1, wxT("UUID"), 0, 800);

	AppendItem(m_strRefType);
}
예제 #16
0
//---------------------------------------------------------------------------------------
DlgChooseLanguage::DlgChooseLanguage(wxWindow* parent, wxWindowID id,
                                   const wxString& title)
    : wxDialog(parent, id, title)
{
    GetLanguages(m_cLangCodes, m_cLangNames);
    m_nNumLangs = m_cLangNames.GetCount();

    wxString sysLang = GetSystemLanguageCode();

    wxBoxSizer *mainSizer = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    wxBoxSizer *hSizer;

    hSizer = LENMUS_NEW wxBoxSizer(wxHORIZONTAL);
    hSizer->Add(LENMUS_NEW wxStaticText(this, -1,
                                    _("Choose language to use:")),
                0, wxALIGN_CENTRE | wxALIGN_CENTER_VERTICAL | wxALL, 8);

    wxString *langArray = LENMUS_NEW wxString[m_nNumLangs];
    for(int i=0; i < m_nNumLangs; i++)
        langArray[i] = m_cLangNames[i];
    m_pChoice = LENMUS_NEW wxChoice(this, -1, wxDefaultPosition, wxDefaultSize,
                            m_nNumLangs, langArray);
    m_pChoice->SetSelection(0); // in case nothing else matches
    delete[] langArray;

    for(int i=0; i < m_nNumLangs; i++)
    {
        if (m_cLangCodes[i] == sysLang)
            m_pChoice->SetSelection(i);
    }
    hSizer->Add(m_pChoice,
                0, wxALIGN_CENTRE | wxALIGN_CENTER_VERTICAL | wxALL, 8);

    mainSizer->Add(hSizer,
                    0, wxALL, 8);

    wxButton *ok = LENMUS_NEW wxButton(this, wxID_OK, _("OK"));
    ok->SetDefault();
    mainSizer->Add(ok, 0, wxALIGN_CENTRE | wxALL, 8);

    SetAutoLayout(true);
    SetSizer(mainSizer);
    mainSizer->Fit(this);
    mainSizer->SetSizeHints(this);

    // set default language, just in case user closes the dialog by clicking on
    // the dialog title [X] button
    m_sLang = m_cLangCodes[m_pChoice->GetSelection()];
}
예제 #17
0
파일: gui.cpp 프로젝트: HeavenIsLost/rme
void GUI::ShowTextBox(wxWindow* parent, wxString title, wxString content)
{
	wxDialog* dlg = newd wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX);
	wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL);
	wxTextCtrl* text_field = newd wxTextCtrl(dlg, wxID_ANY, content, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
	text_field->SetMinSize(wxSize(400, 550));
	topsizer->Add(text_field, wxSizerFlags(5).Expand());

	wxSizer* choicesizer = newd wxBoxSizer(wxHORIZONTAL);
	choicesizer->Add(newd wxButton(dlg, wxID_CANCEL, wxT("OK")), wxSizerFlags(1).Center());
	topsizer->Add(choicesizer, wxSizerFlags(0).Center());
	dlg->SetSizerAndFit(topsizer);

	dlg->ShowModal();
}
예제 #18
0
파일: gui.cpp 프로젝트: HeavenIsLost/rme
void GUI::ListDialog(wxWindow* parent, wxString title, const wxArrayString& param_items)
{
	if(param_items.empty())
		return;

	wxArrayString list_items(param_items);

	// Create the window
	wxDialog* dlg = newd wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX);

	wxSizer* sizer = newd wxBoxSizer(wxVERTICAL);
	wxListBox* item_list = newd wxListBox(dlg, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SINGLE);
	item_list->SetMinSize(wxSize(500, 300));

	for(size_t i = 0; i != list_items.GetCount();) {
		wxString str = list_items[i];
		size_t pos = str.find(wxT("\n"));
		if(pos != wxString::npos) {
			// Split string!
			item_list->Append(str.substr(0, pos));
			list_items[i] = str.substr(pos+1);
			continue;
		}
		item_list->Append(list_items[i]);
		++i;
	}
	sizer->Add(item_list, 1, wxEXPAND);

	wxSizer* stdsizer = newd wxBoxSizer(wxHORIZONTAL);
	stdsizer->Add(newd wxButton(dlg, wxID_OK, wxT("OK")), wxSizerFlags(1).Center());
	sizer->Add(stdsizer, wxSizerFlags(0).Center());

	dlg->SetSizerAndFit(sizer);

	// Show the window
	dlg->ShowModal();
	delete dlg;
}
예제 #19
0
void ScriptSelectorDlg::CreateControls()
{    
////@begin ScriptSelectorDlg content construction
    ScriptSelectorDlg* dlg = this;

    wxBoxSizer* mainSizer = XGC_NEW wxBoxSizer(wxVERTICAL);
    dlg->SetSizer(mainSizer);

    mListCtrl = XGC_NEW wxListCtrl( dlg, ID_LISTCTRL, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
    mainSizer->Add(mListCtrl, 1, wxGROW|wxALL, 5);

    wxBoxSizer* btnSizer = XGC_NEW wxBoxSizer(wxHORIZONTAL);
    mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT|wxALL, 5);

    wxButton* btnConfirm = XGC_NEW wxButton( dlg, ID_BUTTON_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
    btnSizer->Add(btnConfirm, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxButton* btnCancel = XGC_NEW wxButton( dlg, ID_BUTTON_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    btnSizer->Add(btnCancel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    // Connect events and objects
    mListCtrl->Connect(ID_LISTCTRL, wxEVT_LEFT_DCLICK, wxMouseEventHandler(ScriptSelectorDlg::OnLeftDClick), NULL, this);
////@end ScriptSelectorDlg content construction
	mListCtrl->AppendColumn( "Name", wxLIST_FORMAT_LEFT, 80 );
	mListCtrl->AppendColumn( "Path", wxLIST_FORMAT_LEFT, 400 );
	mListCtrl->AppendColumn( "Version", wxLIST_FORMAT_LEFT, 100 );

	auto &loader_path = getConfig().GetLoaderPath();
	auto &module_path = getConfig().GetModulePath();

	if( !fs::exists( loader_path ) )
		return;

	if( !fs::exists( module_path ) )
		return;

	int i = 0;
	xgc_string version;

	for( const auto &entry : fs::directory_iterator { module_path } )
	{
		if( fs::is_directory( entry ) )
		{
			if( entry.path() == fs::path(loader_path) )
				continue;

			if( !fs::exists( entry.path() / "version.py" ) )
				continue;

			if( !getScript().GetModuleVersion( entry.path().filename().string(), version ) )
				continue;

			int item = mListCtrl->InsertItem( i++, entry.path().filename().string(), -1 );
			if( item != -1 )
			{
				mListCtrl->SetItem( item, 1, entry.path().string() );
				mListCtrl->SetItem( item, 2, version );
			}
		}
	}
}
예제 #20
0
EffectRack::EffectRack()
:  wxFrame(GetActiveProject(),
      wxID_ANY,
      _("Effects Rack"),
      wxDefaultPosition,
      wxDefaultSize,
      wxSYSTEM_MENU |
      wxCLOSE_BOX |
      wxCAPTION |
      wxFRAME_NO_TASKBAR |
      wxFRAME_FLOAT_ON_PARENT)
{
   mBypassing = false;
   mNumEffects = 0;
   mLastLatency = 0;
   mTimer.SetOwner(this);

   mPowerPushed = CreateBitmap(power_on_16x16_xpm, false, false);
   mPowerRaised = CreateBitmap(power_off_16x16_xpm, true, false);
   mSettingsPushed = CreateBitmap(settings_up_16x16_xpm, false, true);
   mSettingsRaised = CreateBitmap(settings_down_16x16_xpm, true, true);
   mUpDisabled = CreateBitmap(up_9x16_xpm, true, true);
   mUpPushed = CreateBitmap(up_9x16_xpm, false, true);
   mUpRaised = CreateBitmap(up_9x16_xpm, true, true);
   mDownDisabled = CreateBitmap(down_9x16_xpm, true, true);
   mDownPushed = CreateBitmap(down_9x16_xpm, false, true);
   mDownRaised = CreateBitmap(down_9x16_xpm, true, true);
   mFavPushed = CreateBitmap(fav_down_16x16_xpm, false, false);
   mFavRaised = CreateBitmap(fav_up_16x16_xpm, true, false);
   mRemovePushed = CreateBitmap(remove_16x16_xpm, false, true);
   mRemoveRaised = CreateBitmap(remove_16x16_xpm, true, true);

   {
      auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL);
      mPanel = safenew wxPanel(this, wxID_ANY);
      bs->Add(mPanel, 1, wxEXPAND);
      SetSizer(bs.release());
   }

   {
      auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL);
      {
         auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
         wxASSERT(mPanel); // To justify safenew
         hs->Add(safenew wxButton(mPanel, wxID_APPLY, _("&Apply")), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
         hs->AddStretchSpacer();
         mLatency = safenew wxStaticText(mPanel, wxID_ANY, _("Latency: 0"));
         hs->Add(mLatency, 0, wxALIGN_CENTER);
         hs->AddStretchSpacer();
         hs->Add(safenew wxToggleButton(mPanel, wxID_CLEAR, _("&Bypass")), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
         bs->Add(hs.release(), 0, wxEXPAND);
      }
      bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND);

      {
         auto uMainSizer = std::make_unique<wxFlexGridSizer>(7);
         uMainSizer->AddGrowableCol(6);
         uMainSizer->SetHGap(0);
         uMainSizer->SetVGap(0);
         bs->Add((mMainSizer = uMainSizer.release()), 1, wxEXPAND);
      }

      mPanel->SetSizer(bs.release());
   }

   wxString oldPath = gPrefs->GetPath();
   gPrefs->SetPath(wxT("/EffectsRack"));
   size_t cnt = gPrefs->GetNumberOfEntries();
   gPrefs->SetPath(oldPath);

   EffectManager & em = EffectManager::Get();
   for (size_t i = 0; i < cnt; i++)
   {
      wxString slot;
      gPrefs->Read(wxString::Format(wxT("/EffectsRack/Slot%02d"), i), &slot);

      Effect *effect = em.GetEffect(slot.AfterFirst(wxT(',')).c_str());
      if (effect)
      {
         Add(effect, slot.BeforeFirst(wxT(',')) == wxT("1"), true);
      }
   }

   Fit();
}
예제 #21
0
void TreeGeneratorFrame::createWxCtrls()
{
	// menu
	SetIcon(wxIcon(L"./Assets/Icons/Zee.xpm", wxBITMAP_TYPE_XPM));

	wxMenu* menuFile = New wxMenu;
	menuFile->Append(ID_MENU_OPEN, L"&Open");
	menuFile->Append(ID_MENU_SAVE, L"&Save");

	wxMenuBar* menuBar = New wxMenuBar;
	menuBar->Append(menuFile, L"&File");

	SetMenuBar(menuBar);

	// wnd
	wxBoxSizer* boxSizer1 = New wxBoxSizer(wxHORIZONTAL);

	// left
	mCtrlsPanel = New wxScrolledWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
	mCtrlsPanel->SetScrollRate(0, 5);

	wxBoxSizer* boxSizer2 = New wxBoxSizer(wxVERTICAL);

	// -- generalParams
	mPanelGeneralParams = New wxCollapsiblePane(mCtrlsPanel, ID_GENERAL_PARAMS, L"General Params");
	wxWindow* generalParamsWnd = mPanelGeneralParams->GetPane();

	wxFlexGridSizer* fgSizer1 = New wxFlexGridSizer(2, 2, 0, 0);
	fgSizer1->SetFlexibleDirection(wxBOTH);
	fgSizer1->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);

	wxStaticText* textLevels = New wxStaticText(generalParamsWnd, -1, L"Levels");
	mSpinLevels = New wxSpinCtrl(generalParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
		wxSP_ARROW_KEYS, 0, 5, 1);

	wxStaticText* textScale = New wxStaticText(generalParamsWnd, -1, L"Scale");
	mTextScale = New wxTextCtrl(generalParamsWnd, -1, L"10.0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textScaleV = New wxStaticText(generalParamsWnd, -1, L"ScaleV");
	mTextScaleV = New wxTextCtrl(generalParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textBaseSize = New wxStaticText(generalParamsWnd, -1, L"BaseSize");
	mTextBaseSize = New wxTextCtrl(generalParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textRadiusRatio = New wxStaticText(generalParamsWnd, -1, L"RadiusRatio");
	mTextRadiusRatio = New wxTextCtrl(generalParamsWnd, -1, L"0.02", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textRatioPower = New wxStaticText(generalParamsWnd, -1, L"RatioPower");
	mTextRatioPower = New wxTextCtrl(generalParamsWnd, -1, L"1", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textShape = New wxStaticText(generalParamsWnd, -1, L"Shape");
	mSpinShape = New wxSpinCtrl(generalParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
		wxSP_ARROW_KEYS, 0, 10, 0);

	wxStaticText* textBaseSplits = New wxStaticText(generalParamsWnd, -1, L"BaseSplits");
	mSpinBaseSplits = New wxSpinCtrl(generalParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
		wxSP_ARROW_KEYS, 0, 10, 0);

	fgSizer1->Add(textLevels, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mSpinLevels, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer1->Add(textScale, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mTextScale, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer1->Add(textScaleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mTextScaleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer1->Add(textBaseSize, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mTextBaseSize, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer1->Add(textRadiusRatio, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mTextRadiusRatio, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer1->Add(textRatioPower, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mTextRatioPower, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer1->Add(textShape, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mSpinShape, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer1->Add(textBaseSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer1->Add(mSpinBaseSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	generalParamsWnd->SetSizer(fgSizer1);
	generalParamsWnd->Layout();
	generalParamsWnd->Fit();

	// -- LevelParams
	mPanelLevelParmas0 = New wxCollapsiblePane(mCtrlsPanel, ID_GENERAL_PARAMS, L"Level Params");
	wxWindow* levelParamsWnd = mPanelLevelParmas0->GetPane();

	wxFlexGridSizer* fgSizer2 = New wxFlexGridSizer(2, 2, 0, 0);
	fgSizer2->SetFlexibleDirection(wxBOTH);
	fgSizer2->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);

	wxStaticText* textLevel = New wxStaticText(levelParamsWnd, -1, L"Level");
	//mSpinLevel = new wxSpinCtrl(levelParamsWnd0, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
	//	wxSP_ARROW_KEYS, 0, 10, 0);
	wxArrayString choices;
	choices.Add(wxT("0"));
	mChoiceLevel = New wxChoice(levelParamsWnd, -1, wxDefaultPosition, wxDefaultSize, choices);
	mChoiceLevel->SetSelection(0);
	mSelectedLevel = 0;

	wxStaticText* textSegSegsW = New wxStaticText(levelParamsWnd, -1, L"SegSegsW");
	mSpinSegSegsW = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
		wxSP_ARROW_KEYS, 0, 100, 8);

	wxStaticText* textSegSegsH = New wxStaticText(levelParamsWnd, -1, L"SegSegsH");
	mSpinSegSegsH = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
		wxSP_ARROW_KEYS, 0, 100, 4);

	wxStaticText* textLength = New wxStaticText(levelParamsWnd, -1, L"Length");
	mTextLength = New wxTextCtrl(levelParamsWnd, -1, L"1.0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textLengthV = New wxStaticText(levelParamsWnd, -1, L"LengthV");
	mTextLengthV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textTaper = New wxStaticText(levelParamsWnd, -1, L"Taper");
	mTextTaper = New wxTextCtrl(levelParamsWnd, -1, L"1", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textCurveRes = New wxStaticText(levelParamsWnd, -1, L"CurveRes");
	mSpinCurveRes = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
		wxSP_ARROW_KEYS, 0, 100, 3);

	wxStaticText* textCurve = New wxStaticText(levelParamsWnd, -1, L"Curve");
	mTextCurve = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textCurveV = New wxStaticText(levelParamsWnd, -1, L"CurveV");
	mTextCurveV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textCurveBack = New wxStaticText(levelParamsWnd, -1, L"CurveBack");
	mTextCurveBack = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textSegSplits = New wxStaticText(levelParamsWnd, -1, L"SegSplits");
	mTextSegSplits = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textSplitAngle = New wxStaticText(levelParamsWnd, -1, L"SplitAngle");
	mTextSplitAngle = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textSplitAngleV = New wxStaticText(levelParamsWnd, -1, L"SplitAngleV");
	mTextSplitAngleV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textBranches = New wxStaticText(levelParamsWnd, -1, L"Branches");
	mSpinBranches = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
		wxSP_ARROW_KEYS, 0, 100, 0);

	wxStaticText* textDownAngle = New wxStaticText(levelParamsWnd, -1, L"DownAngle");
	mTextDownAngle = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textDownAngleV = New wxStaticText(levelParamsWnd, -1, L"DownAngleV");
	mTextDownAngleV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textRotateAngle = New wxStaticText(levelParamsWnd, -1, L"RotateAngle");
	mTextRotateAngle = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));

	wxStaticText* textRotateAngleV = New wxStaticText(levelParamsWnd, -1, L"RotateAngleV");
	mTextRotateAngleV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, 
		wxTextValidator(wxFILTER_NUMERIC));


	fgSizer2->Add(textLevel, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mChoiceLevel, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5);

	fgSizer2->Add(textSegSegsW, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mSpinSegSegsW, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textSegSegsH, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mSpinSegSegsH, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textLength, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextLength, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textLengthV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextLengthV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textTaper, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextTaper, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textCurveRes, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mSpinCurveRes, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textCurve, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextCurve, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textCurveV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextCurveV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textCurveBack, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextCurveBack, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textSegSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextSegSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textSplitAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextSplitAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textSplitAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextSplitAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textBranches, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mSpinBranches, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textDownAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextDownAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textDownAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextDownAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textRotateAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextRotateAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	fgSizer2->Add(textRotateAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	fgSizer2->Add(mTextRotateAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	levelParamsWnd->SetSizer(fgSizer2);
	levelParamsWnd->Layout();
	levelParamsWnd->Fit();

	// button
	mButtonGenerate = New wxButton(mCtrlsPanel, ID_BUTTON_GENERATE, L"Generate");

	boxSizer2->Add(mPanelGeneralParams, 0, wxALL, 5);
	boxSizer2->Add(mPanelLevelParmas0, 0, wxALL, 5);
	boxSizer2->Add(mButtonGenerate, 0, wxALL, 5);

	mCtrlsPanel->SetSizer(boxSizer2);
	mCtrlsPanel->SetMinSize(wxSize(240, 600));
	mCtrlsPanel->FitInside();
	mCtrlsPanel->Layout();

	// right
	mCanvasPanel = New wxPanel(this, -1);
	mCanvasPanel->SetMinSize(wxSize(480, 600));

	boxSizer1->Add(mCtrlsPanel, 0, wxALL, 5);
	boxSizer1->Add(mCanvasPanel, 0, wxALL, 5);

	this->SetSizer(boxSizer1);
	this->Layout();
	this->Fit();

	mSpinLevels->Connect(wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler(TreeGeneratorFrame::OnSpinLevels), NULL, this);
	mChoiceLevel->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(TreeGeneratorFrame::OnChoiceLevel), NULL, this);
}
예제 #22
0
LabelDialog::LabelDialog(wxWindow *parent,
                         TrackFactory &factory,
                         TrackList *tracks,
                         ViewInfo &viewinfo,
                         double rate,
                         const wxString & format)
: wxDialog(parent,
           wxID_ANY,
           _("Edit Labels"),
           wxDefaultPosition,
           wxSize(800, 600),
           wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
  mFactory(factory),
  mTracks(tracks),
  mViewInfo(&viewinfo),
  mRate(rate),
  mFormat(format)
{
   SetName(GetTitle());

   {
      // Create the main sizer
      auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);

      // A little instruction
      wxStaticText *instruct =
         safenew wxStaticText(this,
         wxID_ANY,
         _("Press F2 or double click to edit cell contents."));
      instruct->SetName(instruct->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
      vs->Add(instruct,
         0,
         wxALIGN_LEFT | wxALL,
         5);

      // Create the main sizer
      mGrid = safenew Grid(this, wxID_ANY);
      vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);

      // Create the action buttons
      {
         auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
         hs->Add(safenew wxButton(this, ID_INSERTA, _("Insert &After")), 1, wxCENTER | wxALL, 5);
         hs->Add(safenew wxButton(this, ID_INSERTB, _("Insert &Before")), 1, wxCENTER | wxALL, 5);
         hs->Add(safenew wxButton(this, ID_REMOVE, _("&Remove")), 1, wxCENTER | wxALL, 5);
         hs->Add(safenew wxButton(this, ID_IMPORT, _("&Import...")), 1, wxCENTER | wxALL, 5);
         hs->Add(safenew wxButton(this, ID_EXPORT, _("&Export...")), 1, wxCENTER | wxALL, 5);
         vs->Add(hs.release(), 0, wxEXPAND | wxCENTER | wxALL, 5);
      }

      // Create the exit buttons
      vs->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND);

      // Make it so
      SetSizer(vs.release());
   }

   // Build the initial (empty) grid
   mGrid->CreateGrid(0, Col_Max);
   mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER);

   /* i18n-hint: (noun).  A track contains waves, audio etc.*/
   mGrid->SetColLabelValue(0,_("Track"));
   /* i18n-hint: (noun)*/
   mGrid->SetColLabelValue(1,_("Label"));
   /* i18n-hint: (noun) of a label*/
   mGrid->SetColLabelValue(2,_("Start Time"));
   /* i18n-hint: (noun) of a label*/
   mGrid->SetColLabelValue(3,_("End Time"));

   // Create and remember editors.  No need to DELETE these as the wxGrid will
   // do it for us.  (The DecRef() that is needed after GetDefaultEditorForType
   // becomes the duty of the wxGridCellAttr objects after we set them in the grid.)
   mChoiceEditor = (ChoiceEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_CHOICE);
   mTimeEditor = (TimeEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_TIME);

   // Initialize and set the track name column attributes
   wxGridCellAttr *attr;
   mGrid->SetColAttr(Col_Track, (attr = safenew wxGridCellAttr));
   attr->SetEditor(mChoiceEditor);
   mTrackNames.Add(_("New..."));

   // Initialize and set the time column attributes
   mGrid->SetColAttr(Col_Stime, (attr = safenew wxGridCellAttr));
   // Don't need DecRef() after this GetDefaultRendererForType.
   attr->SetRenderer(mGrid->GetDefaultRendererForType(GRID_VALUE_TIME));
   attr->SetEditor(mTimeEditor);
   attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);

   mGrid->SetColAttr(Col_Etime, attr->Clone());

   // Seems there's a bug in wxGrid.  Adding only 1 row does not
   // allow SetCellSize() to work properly and you will not get
   // the expected 1 row by 4 column cell.
   //
   // So, we set the minimum row height to 0 and basically hide
   // the extra row by setting its height to 0.  And not allowing the
   // rows to be manually resized prevents the user from ever seeing
   // the extra row.
   mGrid->SetRowMinimalAcceptableHeight(0);
   mGrid->EnableDragRowSize(false);

   // Locate all labels in current track list
   FindAllLabels();

   // Populate the grid
   TransferDataToWindow();

   // Resize the label name column and ensure it doesn't go below an
   // arbitrary width.
   //
   // This should not be in TransferDataToWindow() since a user might
   // resize the column and we'd resize it back to the minimum.
   mGrid->AutoSizeColumn(Col_Label, false );
   mGrid->SetColSize(Col_Label, wxMax(150, mGrid->GetColSize(Col_Label)));
   mGrid->SetColMinimalWidth(Col_Label, mGrid->GetColSize(Col_Label));

   // Layout the works
   Layout();

   // Resize width based on width of columns and the vertical scrollbar
   wxRect r = mGrid->GetGridColLabelWindow()->GetRect();
   wxScrollBar sb(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
   r.width += sb.GetSize().GetWidth() + 6;
   SetClientSize(r.width, 300);

   // Make sure it doesn't go below this size
   r = GetRect();
   SetSizeHints(r.GetWidth(), r.GetHeight());

   // Center on display
   Center();
}
예제 #23
0
ScoreAlignDialog::ScoreAlignDialog(wxWindow *parent, ScoreAlignParams &params)
   : wxDialog(parent, -1, _("Align MIDI to Audio"),
              wxDefaultPosition, wxDefaultSize,
              wxDEFAULT_DIALOG_STYLE)
{
   gScoreAlignDialog = this; // Allows anyone to close dialog by calling
                             // CloseScoreAlignDialog()
   gPrefs->Read(wxT("/Tracks/Synchronize/FramePeriod"), &p.mFramePeriod,
                float(SA_DFT_FRAME_PERIOD));
   gPrefs->Read(wxT("/Tracks/Synchronize/WindowSize"), &p.mWindowSize,
                float(SA_DFT_WINDOW_SIZE));
   gPrefs->Read(wxT("/Tracks/Synchronize/SilenceThreshold"),
                &p.mSilenceThreshold, float(SA_DFT_SILENCE_THRESHOLD));
   gPrefs->Read(wxT("/Tracks/Synchronize/ForceFinalAlignment"),
                &p.mForceFinalAlignment, float(SA_DFT_FORCE_FINAL_ALIGNMENT));
   gPrefs->Read(wxT("/Tracks/Synchronize/IgnoreSilence"),
                &p.mIgnoreSilence, float(SA_DFT_IGNORE_SILENCE));
   gPrefs->Read(wxT("/Tracks/Synchronize/PresmoothTime"), &p.mPresmoothTime,
                float(SA_DFT_PRESMOOTH_TIME));
   gPrefs->Read(wxT("/Tracks/Synchronize/LineTime"), &p.mLineTime,
                float(SA_DFT_LINE_TIME));
   gPrefs->Read(wxT("/Tracks/Synchronize/SmoothTime"), &p.mSmoothTime,
                float(SA_DFT_SMOOTH_TIME));

   //wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
   //wxButton *cancel = safenew wxButton(this, wxID_CANCEL, _("Cancel"));
   //wxSlider *sl = safenew wxSlider(this, ID_SLIDER, 0, 0, 100,
   //                     wxDefaultPosition, wxSize(20, 124),
   //                     wxSL_HORIZONTAL);

   ShuttleGui S(this, eIsCreating);
   //ok->SetDefault();

   S.SetBorder(5);
   S.StartVerticalLay(true);
   S.StartStatic(wxT("Align MIDI to Audio"));
   S.StartMultiColumn(3, wxEXPAND | wxALIGN_CENTER_VERTICAL);
   S.SetStretchyCol(1);

   mFramePeriodLabel = S.AddVariableText(_("Frame Period:"), true,
                                      wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   S.SetStyle(wxSL_HORIZONTAL);
   mFramePeriodSlider = S.Id(ID_FRAMEPERIOD).AddSlider(wxT(""),
       /*pos*/ (int) (p.mFramePeriod * 100 + 0.5), /*max*/ 50, /*min*/ 5);
   S.SetSizeHints(300, -1);
   mFramePeriodSlider->SetName(_("Frame Period"));
   mFramePeriodText = S.AddVariableText(SA_DFT_FRAME_PERIOD_TEXT, true,
                                      wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);

   mWindowSizeLabel = S.AddVariableText(_("Window Size:"), true,
                                      wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   S.SetStyle(wxSL_HORIZONTAL);
   mWindowSizeSlider = S.Id(ID_WINDOWSIZE).AddSlider(wxT(""),
       /*pos*/ (int) (p.mWindowSize * 100 + 0.5), /*max*/ 100, /*min*/ 5);
   mWindowSizeSlider->SetName(_("Window Size"));
   mWindowSizeText = S.AddVariableText(SA_DFT_WINDOW_SIZE_TEXT, true,
                                      wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);

   mForceFinalAlignmentCheckBox = S.Id(ID_FORCEFINALALIGNMENT).AddCheckBox(
                wxT("Force Final Alignment"),
                (p.mForceFinalAlignment ? wxT("true") : wxT("false")));
   mForceFinalAlignmentCheckBox->SetName(_("Force Final Alignment"));
   mIgnoreSilenceCheckBox = S.Id(ID_IGNORESILENCE).AddCheckBox(
                              wxT("Ignore Silence at Beginnings and Endings"),
                              (p.mIgnoreSilence ? wxT("true") : wxT("false")));
   mIgnoreSilenceCheckBox->SetName(
                     _("Ignore Silence at Beginnings and Endings"));
   // need a third column after checkboxes:
   S.AddVariableText(wxT(""), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);

   mSilenceThresholdLabel = S.AddVariableText(_("Silence Threshold:"),
                             true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   S.SetStyle(wxSL_HORIZONTAL);
   mSilenceThresholdSlider = S.Id(ID_SILENCETHRESHOLD).AddSlider(wxT(""),
         /*pos*/ (int) (p.mSilenceThreshold * 1000 + 0.5), /*max*/ 500);
   mSilenceThresholdSlider->SetName(_("Silence Threshold"));
   mSilenceThresholdText = S.AddVariableText(SA_DFT_SILENCE_THRESHOLD_TEXT,
                              true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);

   /* i18n-hint: The English would be clearer if it had 'Duration' rather than 'Time'
      This is a NEW experimental effect, and until we have it documented in the user
      manual we don't have a clear description of what this parameter does.
      It is OK to leave it in English. */
   mPresmoothLabel = S.AddVariableText(_("Presmooth Time:"), true,
                                      wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   S.SetStyle(wxSL_HORIZONTAL);
   mPresmoothSlider = S.Id(ID_PRESMOOTH).AddSlider(wxT(""),
               /*pos*/ (int) (p.mPresmoothTime * 100 + 0.5), /*max*/ 500);
   mPresmoothSlider->SetName(_("Presmooth Time"));
   mPresmoothText = S.AddVariableText(SA_DFT_PRESMOOTH_TIME_TEXT, true,
                                      wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);

   /* i18n-hint: The English would be clearer if it had 'Duration' rather than 'Time'
      This is a NEW experimental effect, and until we have it documented in the user
      manual we don't have a clear description of what this parameter does.
      It is OK to leave it in English. */
   mLineTimeLabel = S.AddVariableText(_("Line Time:"), true,
                                      wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   S.SetStyle(wxSL_HORIZONTAL);
   mLineTimeSlider = S.Id(ID_LINETIME).AddSlider(wxT(""),
                    /*pos*/ (int) (p.mLineTime * 100 + 0.5), /*max*/ 500);
   mLineTimeSlider->SetName(_("Line Time"));
   mLineTimeText = S.AddVariableText(SA_DFT_LINE_TIME_TEXT, true,
                                      wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);

   /* i18n-hint: The English would be clearer if it had 'Duration' rather than 'Time'
      This is a NEW experimental effect, and until we have it documented in the user
      manual we don't have a clear description of what this parameter does.
      It is OK to leave it in English. */
   mSmoothTimeLabel = S.AddVariableText(_("Smooth Time:"), true,
                                      wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   S.SetStyle(wxSL_HORIZONTAL);
   mSmoothTimeSlider = S.Id(ID_SMOOTHTIME).AddSlider(wxT(""),
                  /*pos*/ (int) (p.mSmoothTime * 100 + 0.5), /*max*/ 500);
   mSmoothTimeSlider->SetName(_("Smooth Time"));
   mSmoothTimeText = S.AddVariableText(SA_DFT_SMOOTH_TIME_TEXT, true,
                                      wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);

   S.EndMultiColumn();
   S.EndStatic();

   mDefaultButton = safenew wxButton(this, ID_DEFAULT, _("Use Defaults"));
   mDefaultButton->SetName(_("Restore Defaults"));

   S.AddStandardButtons(eOkButton | eCancelButton, mDefaultButton);
   S.EndVerticalLay();
   Layout();
   Fit();
   Center();

   TransferDataFromWindow(); // set labels according to actual initial values

   params.mStatus = p.mStatus = ShowModal();

   if (p.mStatus == wxID_OK) {
       // Retain the settings
       gPrefs->Write(wxT("/Tracks/Synchronize/FramePeriod"), p.mFramePeriod);
       gPrefs->Write(wxT("/Tracks/Synchronize/WindowSize"), p.mWindowSize);
       gPrefs->Write(wxT("/Tracks/Synchronize/SilenceThreshold"),
                     p.mSilenceThreshold);
       gPrefs->Write(wxT("/Tracks/Synchronize/ForceFinalAlignment"),
                     p.mForceFinalAlignment);
       gPrefs->Write(wxT("/Tracks/Synchronize/IgnoreSilence"),
                     p.mIgnoreSilence);
       gPrefs->Write(wxT("/Tracks/Synchronize/PresmoothTime"),
                     p.mPresmoothTime);
       gPrefs->Write(wxT("/Tracks/Synchronize/LineTime"), p.mLineTime);
       gPrefs->Write(wxT("/Tracks/Synchronize/SmoothTime"), p.mSmoothTime);
       gPrefs->Flush();

       params = p; // return all parameters through params
   }
}