void CVGUIGstringOptions::OnCheckButtonChecked( Panel *panel )
{
	CheckButton *pCheckButton = dynamic_cast< CheckButton* >( panel );
	if ( pCheckButton != NULL )
	{
		bool value = pCheckButton->IsSelected();
		CheckButton *checkButtons[ PP_CHECKS ] = {
			m_pCheck_HurtFX,
			m_pCheck_GodRays,
			m_pCheck_WaterEffects,
			m_pCheck_Vignette,
			m_pCheck_LensFlare,
			m_pCheck_DreamBlur,
			m_pCheck_ScreenBlur,
			m_pCheck_CinemaOverlay
		};
		for ( int i = 0; i < PP_CHECKS; ++i )
		{
			if ( checkButtons[ i ] == panel )
			{
				m_state.checks[ i ] = value;
			}
		}
	}

	OnPresetModified();
}
示例#2
0
void MainMenu::fillLoadMenu( bool save /*= false*/ )
{
    const std::string buttonNames[]={"File0","File1","File2","File3","File4","File5"};

    char** rc = PHYSFS_enumerateFiles("/");

    char* curfile;
    CheckButton *button;

    for(int i=0;i<6;i++) {
        char* recentfile = NULL;
        PHYSFS_sint64 t = 0;

        std::stringstream filestart;
        filestart << i+1 << "_";
        if( save ){
            button = getCheckButton(*saveGameMenu.get(),buttonNames[i]);
        } else {
            button = getCheckButton(*loadGameMenu.get(),buttonNames[i]);
        }
        //make sure Button is connected only once
        button->clicked.clear();
        if( save )
            button->clicked.connect(makeCallback(*this,&MainMenu::selectSaveGameButtonClicked));
        else {
            button->clicked.connect(makeCallback(*this,&MainMenu::selectLoadGameButtonClicked));
        }
        for(char** i = rc; *i != 0; i++){
            curfile = *i;
            if(std::string( curfile ).find( filestart.str() ) == 0 ) {
                // && !( curfile->d_type & DT_DIR  ) ) is not portable. So
                // don't create a directoy named 2_ in a savegame-directory or
                // you can no longer load from slot 2.
                if (t == 0) {
                    recentfile = curfile;
                    t = PHYSFS_getLastModTime(recentfile);
              } else {
                    if (PHYSFS_getLastModTime(curfile) > t) {
/*#ifdef DEBUG
                        fprintf(stderr," %s is more recent than previous %s\n",
                                          curfile, recentfile);
#endif*/
                        recentfile = curfile;
                        t = PHYSFS_getLastModTime(recentfile);
                    }
                }
            }
        }
#ifdef DEBUG
        fprintf(stderr,"Most recent file: %s\n\n",recentfile);
#endif

        if(t != 0) {
            std::string f= recentfile;
            button->setCaptionText(f);
        } else {
            button->setCaptionText(_("empty"));
        }
    }
}
bool CDialogAddBan::IsIPCheck()
{
	CheckButton *entry = dynamic_cast<CheckButton *>(FindChildByName("IPCheck"));
	if (entry)
	{
		return entry->IsSelected();
	}
	return false;
}
	void popup_import(const String& p_from) {

		popup_centered(Size2(400,400));

		if (p_from!="") {

			Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_from);
			ERR_FAIL_COND(!rimd.is_valid());
			ERR_FAIL_COND(rimd->get_source_count()!=1);
			_choose_file(EditorImportPlugin::expand_source_path(rimd->get_source_path(0)));
			_choose_save_dir(p_from.get_base_dir());
			String locale = rimd->get_option("locale");
			bool skip_first=rimd->get_option("skip_first");
			bool compressed = rimd->get_option("compress");

			int idx=-1;

			for(int i=0;i<items.size();i++) {

				String il = TranslationServer::get_all_locales()[items[i]->get_range(1)];
				if (il==locale) {
					idx=i;
					break;
				}
			}

			if (idx!=-1) {
				idx=rimd->get_option("index");
			}

			for(int i=0;i<items.size();i++) {

				if (i==idx) {

					Vector<String> locs = TranslationServer::get_all_locales();
					for(int j=0;j<locs.size();j++) {
						if (locs[j]==locale) {
							items[i]->set_range(1,j);
						}

					}
					items[i]->set_checked(0,true);
				} else {
					items[i]->set_checked(0,false);

				}
			}

			ignore_first->set_pressed(skip_first);
			compress->set_pressed(compressed);



		}

	}
示例#5
0
result
CheckButtonForm::OnInitializing(void)
{
	BaseForm::OnInitializing();
	result r = E_SUCCESS;

	CheckButton* pCheckButton = static_cast <CheckButton*> (GetControl("IDC_CHECKBUTTON_DISABLE", true));
	pCheckButton->SetEnabled(false);

	return r;
}
result Enrollment::OnInitializing(void) {
	result r = E_SUCCESS;
	CheckButton* pCheckBtn = null;

	SetFormBackEventListener(this);

	__pSaveBtn = static_cast<Button*>(GetControl(IDC_SAVE));
	__pDate = static_cast<Label*>(GetControl(IDC_DATE));

	String cBtnName[] = { IDC_CHECKBUTTON_WORK1, IDC_CHECKBUTTON_WORK2,
			IDC_CHECKBUTTON_WORK3, IDC_CHECKBUTTON_WORK4 };

	for (int i = 0; i < MAX_WORK_COUNT; i++) {
		__pWorkList[i] = static_cast<CheckButton*>(GetControl(cBtnName[i]));
	}

	for (int i = 0; i < MAX_WORK_COUNT; i++) {
		pCheckBtn = dynamic_cast<CheckButton*>(GetControl(cBtnName[i]));
		TryReturn(pCheckBtn != null, E_SYSTEM,
				"Unable to get control [%ls]", cBtnName[i].GetPointer());
		pCheckBtn->SetEnabled(false);
		pCheckBtn->SetActionId(ID_WORK_1 + i, ID_WORK_1 + 500 + i);

		pCheckBtn->AddActionEventListener(*this);

	}

//!!!!!!!!!!!!!!!!!!!!!!!!!!!

	String btnName[] = { IDC_PILL_1, IDC_PILL_2, IDC_PILL_3, IDC_MEET, IDC_SAVE,
			IDC_DEL };

	Button* pButton = null;

	for (int i = 0; i < MAX_BTN_COUNT; i++) {
		pButton = dynamic_cast<Button*>(GetControl(btnName[i]));
		TryReturn(pButton != null, E_SYSTEM,
				"Unable to get control [%ls]", btnName[i].GetPointer());

		pButton->SetActionId(IDC_BUTTON_PILL_1 + i);
		pButton->AddActionEventListener(*this);
	}

	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	__pForm = this;
	EnableControl(false);

	return r;
}
示例#7
0
文件: options.cpp 项目: EQ4/seq42
    void
options::transport_callback (button a_type, Button * a_check)
{
    CheckButton *check = (CheckButton *) a_check;

    switch (a_type)
    {

        case e_jack_transport:
            {
                global_with_jack_transport = check->get_active ();
            }
            break;

        case e_jack_master:
            {
                global_with_jack_master = check->get_active ();
            }
            break;

        case e_jack_master_cond:
            {
                global_with_jack_master_cond = check->get_active ();
            }
            break;

        case e_jack_connect:
            {
                m_perf->init_jack ();
            }
            break;


        case e_jack_disconnect:
            {
                m_perf->deinit_jack ();
            }
            break;

        default:
            break;
    }
}
void DClusterSetManagerPage::handleDevClusterAuthorizedInfo(InputPacket& inpack)
{
    quint8 ansCode = inpack.getAnswerCode();
    if(clusterAddManagerPage != NULL){
        clusterAddManagerPage->fetchData(inpack);
        if(ansCode == Mi::Success){//添加管理员成功
            quint64 managerID = clusterAddManagerPage->getManagerID();

            QHash<quint64, DClusterUserInfo*> infoList = userInfoList->fetchList();
            QHashIterator<quint64, DClusterUserInfo*> iter(infoList);
            while(iter.hasNext())
            {
                iter.next();
                DClusterUserInfo* userInfo = dynamic_cast<DClusterUserInfo*>(iter.value());
                if(managerID == userInfo->getUserID()){
                    userInfo->setUserRole(Mi::SeniorManager);
                    this->appendManagerToList(userInfo);
                    return;
                }
            }
        }
        return;
    }

    QString strText;
    if(ansCode == Mi::Success){
        strText = tr("取消管理员成功");
        QHashIterator<quint64, CheckButton*> iter(btnCheckList);
        while(iter.hasNext())
        {
            iter.next();
            CheckButton* btn = iter.value();
            if(btn->getUserID() == curCancelManagerID){
                managerLayout->removeWidget(btn);
                SAFE_DELETE(btn);
            }
        }
    }
    else if(ansCode == Mi::Failure)
        strText = tr("取消管理员失败, 请重试");

    this->handleHintInfo(strText);
}
void CDialog_PPEPrecache::FillList()
{
	ScrollBar *pScroll = m_pList_Effects->GetScrollbar();
	int scrollValue = pScroll ? pScroll->GetValue() : 0;

	m_pList_Effects->DeleteAllItems();

	GetPPCache()->ClearInvalidEntries();

	HFont fontMarlett = scheme()->GetIScheme( GetScheme() )->GetFont( "Marlett", false );

	for ( int i = 0; i < GetPPCache()->GetNumPostProcessingEffects(); i++ )
	{
		EditorPostProcessingEffect *effect = GetPPCache()->GetPostProcessingEffect( i );

		Label *pL = new Label( m_pList_Effects, "", effect->pszName );
		Button *pDel = new Button( m_pList_Effects, "", "Delete", this, VarArgs("del_effect_%i",i) );
		CheckButton *pCheck = new CheckButton( m_pList_Effects, effect->pszName, "" );

		pCheck->AddActionSignalTarget( this );
		pCheck->SetSelected( effect->bStartEnabled );

		Button *pDown = new Button( m_pList_Effects, "", "u", this, VarArgs("movedown_effect_%i",i) );
		Button *pUp = new Button( m_pList_Effects, "", "t", this, VarArgs("moveup_effect_%i",i) );

		pDown->SetFont( fontMarlett );
		pUp->SetFont( fontMarlett );

		pDel->SetContentAlignment( Label::a_center );
		pDown->SetContentAlignment( Label::a_center );
		pUp->SetContentAlignment( Label::a_center );

		m_pList_Effects->AddItem( NULL, pCheck );
		m_pList_Effects->AddItem( NULL, pDown );
		m_pList_Effects->AddItem( NULL, pUp );
		m_pList_Effects->AddItem( pL, pDel );
	}

	if ( pScroll )
		pScroll->SetValue( scrollValue );
}
	void _import() {


		if (items.size()==0) {
			error_dialog->set_text(TTR("No items to import!"));
			error_dialog->popup_centered(Size2(200,100));
		}

		if (!save_path->get_text().begins_with("res://")) {
			error_dialog->set_text(TTR("No target path!"));
			error_dialog->popup_centered(Size2(200,100));
		}

		EditorProgress progress("import_xl",TTR("Import Translations"),items.size());
		for(int i=0;i<items.size();i++) {

			progress.step(items[i]->get_metadata(1),i);
			if (!items[i]->is_checked(0))
				continue;

			String locale = TranslationServer::get_all_locales()[items[i]->get_range(1)];
			Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
			imd->add_source(EditorImportPlugin::validate_source_path(import_path->get_text()));
			imd->set_option("locale",locale);
			imd->set_option("index",i);
			imd->set_option("skip_first",ignore_first->is_pressed());
			imd->set_option("compress",compress->is_pressed());

			String savefile = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+"."+locale+".xl");
			Error err = plugin->import(savefile,imd);
			if (err!=OK) {
				error_dialog->set_text(TTR("Couldn't import!"));
				error_dialog->popup_centered(Size2(200,100));
			} else if (add_to_project->is_pressed()) {

				ProjectSettings::get_singleton()->add_translation(savefile);
			}
		}
		hide();

	}
示例#11
0
文件: options.cpp 项目: Stazed/seq24
/*MIDI Input page*/
void
options::add_midi_input_page()
{
    // Input Buses
    int buses = m_perf->get_master_midi_bus ()->get_num_in_buses ();

    VBox *vbox = manage(new VBox ());
    vbox->set_border_width(6);
    m_notebook->append_page(*vbox, "MIDI _Input", true);

    for (int i = 0; i < buses; i++)
    {
        CheckButton *check = manage(new CheckButton(
                                        m_perf->get_master_midi_bus()->get_midi_in_bus_name(i), 0));
        check->signal_toggled().connect(bind(mem_fun(*this,
                                             &options::input_callback), i, check));
        check->set_active(m_perf->get_master_midi_bus()->get_input(i));

        vbox->pack_start(*check, false, false);
    }
}
示例#12
0
void DClusterSetManagerPage::on_btnCancelManager_clicked()
{
    CheckButton* btn = dynamic_cast<CheckButton*>(sender());
    btn->setReviewText(tr("取消管理员"));
    quint8 role = Mi::Operator;
    curCancelManagerID = btn->getUserID();

    AssemblyData assemblyData;
    assemblyData.append(curClusterID);
    assemblyData.append(role);
    assemblyData.append(curCancelManagerID);

    char* data = assemblyData.getAssemblyData();
    quint16 dataLen = assemblyData.getAssemblyDataLen();
    emit readyRead(CommandCode::DCLUSTER_SETTING_USER_AUTHORIZE, data, dataLen);

    //页面加载窗口
    if(loadingPage == NULL){
        loadingPage = new LoadingPage(this);
        loadingPage->show();
    }
}
示例#13
0
文件: options.cpp 项目: Stazed/seq24
void
options::transport_callback(button a_type, Button *a_check)
{
    CheckButton *check = (CheckButton *) a_check;

    switch (a_type)
    {
    case e_jack_transport:
        global_with_jack_transport = check->get_active();
        break;

    case e_jack_master:
        global_with_jack_master = check->get_active();
        break;

    case e_jack_master_cond:
        global_with_jack_master_cond = check->get_active();
        break;

    default:
        break;
    }
}
示例#14
0
文件: options.cpp 项目: Stazed/seq24
/*Jack Sync page */
void
options::add_jack_sync_page()
{
#ifdef JACK_SUPPORT
    VBox *vbox = manage(new VBox());
    vbox->set_border_width(4);
    m_notebook->append_page(*vbox, "_Jack Sync", true);

    /*Frame for transport options*/
    Frame* transportframe = manage(new Frame("Transport"));
    transportframe->set_border_width(4);
    vbox->pack_start(*transportframe, Gtk::PACK_SHRINK);

    VBox *transportbox = manage(new VBox());
    transportbox->set_border_width(4);
    transportframe->add(*transportbox);

    CheckButton *check = manage(new CheckButton("Jack _Transport", true));
    check->set_active (global_with_jack_transport);
    add_tooltip( check, "Enable sync with JACK Transport.");
    check->signal_toggled().connect(bind(mem_fun(*this,
                                         &options::transport_callback), e_jack_transport, check));

    transportbox->pack_start(*check, false, false);

    check = manage(new CheckButton("Trans_port Master", true));
    check->set_active (global_with_jack_master);
    add_tooltip( check, "Seq24 will attempt to serve as JACK Master.");
    check->signal_toggled().connect(bind(mem_fun(*this,
                                         &options::transport_callback), e_jack_master, check));

    transportbox->pack_start(*check, false, false);

    check = manage (new CheckButton ("Master C_onditional", true));
    check->set_active (global_with_jack_master_cond);
    add_tooltip( check,
                 "Seq24 will fail to be master if there is already a master set.");
    check->signal_toggled().connect(bind(mem_fun(*this,
                                         &options::transport_callback), e_jack_master_cond, check));

    transportbox->pack_start(*check, false, false);

#endif
}
示例#15
0
//==== Create & Init Gui CheckButton  ====//
void GroupLayout::AddButton( CheckButton& cbutton, const char* label )
{
    assert( m_Group && m_Screen );

    //==== Add Check Button ====//
    int bw = FitWidth( 0, m_ButtonWidth );
    Fl_Check_Button* flbutton = new Fl_Check_Button( m_X, m_Y, bw, m_StdHeight, label );
    flbutton->box( FL_DOWN_BOX );
    flbutton->down_box( FL_DOWN_BOX );
    flbutton->labelfont( 1 );
    flbutton->labelsize( 12 );
    flbutton->labelcolor( FL_DARK_BLUE );
    flbutton->copy_label( label );
    m_Group->add( flbutton );
    AddX( bw );

    AddY( m_StdHeight );
    NewLineX();

    cbutton.Init( m_Screen, flbutton );
}
示例#16
0
文件: options.cpp 项目: Stazed/seq24
/*Keybinding setup (editor for .seq24rc keybindings).*/
void
options::add_keyboard_page()
{
    VBox *mainbox = manage(new VBox());
    mainbox->set_spacing(6);
    m_notebook->append_page(*mainbox, "_Keyboard", true);

    Label* label;
    KeyBindEntry* entry;

    HBox *hbox = manage (new HBox());
    CheckButton *check = manage(new CheckButton(
                                    "_Show key labels on sequences", true));
    check->signal_toggled().connect(bind(mem_fun(*this,
                                         &options::input_callback), (int)e_keylabelsonsequence,
                                         check));
    check->set_active(m_perf->m_show_ui_sequence_key);
    mainbox->pack_start(*check, false, false);

    /*Frame for sequence toggle keys*/
    Frame* controlframe = manage(new Frame("Control keys"));
    controlframe->set_border_width(4);
    mainbox->pack_start(*controlframe, Gtk::PACK_SHRINK);

    Table* controltable = manage(new Table(4, 8, false));
    controltable->set_border_width(4);
    controltable->set_spacings(4);
    controlframe->add(*controltable);

    label = manage(new Label("Start", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_start));
    controltable->attach(*label, 0, 1, 0, 1);
    controltable->attach(*entry, 1, 2, 0, 1);

    label = manage(new Label("Stop", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_stop));
    controltable->attach(*label, 0, 1, 1, 2);
    controltable->attach(*entry, 1, 2, 1, 2);

    label = manage(new Label("Song", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_song));
    controltable->attach(*label, 0, 1, 2, 3);
    controltable->attach(*entry, 1, 2, 2, 3);
#ifdef JACK_SUPPORT
    label = manage(new Label("Jack", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_jack));
    controltable->attach(*label, 0, 1, 3, 4);
    controltable->attach(*entry, 1, 2, 3, 4);
#endif // JACK_SUPPORT

    label = manage(new Label("Snapshot 1", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_snapshot_1));
    controltable->attach(*label, 2, 3, 0, 1);
    controltable->attach(*entry, 3, 4, 0, 1);

    label = manage(new Label("Snapshot 2", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_snapshot_2));
    controltable->attach(*label, 2, 3, 1, 2);
    controltable->attach(*entry, 3, 4, 1, 2);

    label = manage(new Label("bpm down", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_bpm_dn));
    controltable->attach(*label, 2, 3, 3, 4);
    controltable->attach(*entry, 3, 4, 3, 4);

    label = manage(new Label("bpm up", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_bpm_up));
    controltable->attach(*label, 2, 3, 2, 3);
    controltable->attach(*entry, 3, 4, 2, 3);

    label = manage(new Label("Replace", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_replace));
    controltable->attach(*label, 4, 5, 0, 1);
    controltable->attach(*entry, 5, 6, 0, 1);

    label = manage(new Label("Queue", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_queue));
    controltable->attach(*label, 4, 5, 1, 2);
    controltable->attach(*entry, 5, 6, 1, 2);

    label = manage(new Label("Keep queue", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_keep_queue));
    controltable->attach(*label, 4, 5, 2, 3);
    controltable->attach(*entry, 5, 6, 2, 3);

    label = manage(new Label("Menu mode", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_menu));
    controltable->attach(*label, 4, 5, 3, 4);
    controltable->attach(*entry, 5, 6, 3, 4);

    label = manage(new Label("Screenset up", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_screenset_up));
    controltable->attach(*label, 6, 7, 0, 1);
    controltable->attach(*entry, 7, 8, 0, 1);

    label = manage(new Label("Screenset down", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_screenset_dn));
    controltable->attach(*label, 6, 7, 1, 2);
    controltable->attach(*entry, 7, 8, 1, 2);

    label = manage(new Label("Set playing screenset", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_set_playing_screenset));
    controltable->attach(*label, 6, 7, 2, 3);
    controltable->attach(*entry, 7, 8, 2, 3);

    label = manage(new Label("Follow transport", Gtk::ALIGN_RIGHT));
    entry = manage(new KeyBindEntry(KeyBindEntry::location,
                                    &m_perf->m_key_follow_trans));
    controltable->attach(*label, 6, 7, 3, 4);
    controltable->attach(*entry, 7, 8, 3, 4);

    /*Frame for sequence toggle keys*/
    Frame* toggleframe = manage(new Frame("Sequence toggle keys"));
    toggleframe->set_border_width(4);
    mainbox->pack_start(*toggleframe, Gtk::PACK_SHRINK);

    Table* toggletable = manage(new Table(4, 16, false));
    toggletable->set_border_width(4);
    toggletable->set_spacings(4);
    toggleframe->add(*toggletable);

    int x = 0;
    int y = 0;
    Label* numlabel;

    for (int i = 0; i < 32; i++)
    {
        x = i % 8 * 2;
        y = i / 8;
        int slot = x * 2 + y; // count this way: 0, 4, 8, 16...
        char buf[16];
        snprintf(buf, sizeof(buf), "%d", slot);
        numlabel = manage(new Label(buf, Gtk::ALIGN_RIGHT));
        entry = manage(new KeyBindEntry(KeyBindEntry::events, NULL,
                                        m_perf, slot));
        toggletable->attach(*numlabel, x, x + 1, y, y + 1);
        toggletable->attach(*entry, x + 1, x + 2, y, y + 1);
    }

    /*Frame for mute group slots*/
    Frame* mutegroupframe = manage(new Frame("Mute-group slots"));
    mutegroupframe->set_border_width(4);
    mainbox->pack_start(*mutegroupframe, Gtk::PACK_SHRINK);

    Table* mutegrouptable = manage(new Table(4, 16, false));
    mutegrouptable->set_border_width(4);
    mutegrouptable->set_spacings(4);
    mutegroupframe->add(*mutegrouptable);

    for (int i = 0; i <32; i++)
    {
        x = i%8*2;
        y = i/8;
        char buf[16];
        snprintf(buf, sizeof(buf), "%d", i);
        numlabel = manage(new Label(buf, Gtk::ALIGN_RIGHT));
        entry = manage(new KeyBindEntry(KeyBindEntry::groups, NULL,
                                        m_perf, i));
        mutegrouptable->attach(*numlabel, x, x + 1, y, y + 1);
        mutegrouptable->attach(*entry, x + 1, x + 2, y, y + 1);
    }

#define AddKey(text, integer) \
    label = manage(new Label(text)); \
    hbox->pack_start(*label, false, false, 4); \
    entry = manage(new KeyBindEntry(KeyBindEntry::location, &integer)); \
    hbox->pack_start(*entry, false, false, 4);

    hbox = manage(new HBox());
    AddKey("Learn (while pressing a mute-group key):",
           m_perf->m_key_group_learn);
    AddKey("Disable:", m_perf->m_key_group_off);
    AddKey("Enable:", m_perf->m_key_group_on);
    mainbox->pack_start (*hbox, false, false);

#undef AddKey
}
//-----------------------------------------------------------------------------
// Purpose: Creates all the controls in the game options list
//-----------------------------------------------------------------------------
void CCreateMultiplayerGameGameplayPage::LoadGameOptionsList()
{
	// destroy any existing controls
	mpcontrol_t *p, *n;

	p = m_pList;
	while ( p )
	{
		n = p->next;
		//
		delete p->pControl;
		delete p->pPrompt;
		delete p;
		p = n;
	}

	m_pList = NULL;


	// Go through desciption creating controls
	CScriptObject *pObj;

	pObj = m_pDescription->pObjList;

	mpcontrol_t	*pCtrl;

	CheckButton *pBox;
	TextEntry *pEdit;
	ComboBox *pCombo;
	CScriptListItem *pListItem;

	Panel *objParent = m_pOptionsList;

	while ( pObj )
	{
		pCtrl = new mpcontrol_t( objParent, "mpcontrol_t" );
		pCtrl->type = pObj->type;

		switch ( pCtrl->type )
		{
		case O_BOOL:
			pBox = new CheckButton( pCtrl, "DescCheckButton", pObj->prompt );
			pBox->SetSelected( pObj->fdefValue != 0.0f ? true : false );
			
			pCtrl->pControl = (Panel *)pBox;
			break;
		case O_STRING:
		case O_NUMBER:
			pEdit = new TextEntry( pCtrl, "DescTextEntry");
			pEdit->InsertString(pObj->defValue);
			pCtrl->pControl = (Panel *)pEdit;
			break;
		case O_LIST:
			pCombo = new ComboBox( pCtrl, "DescComboBox", 5, false );

			pListItem = pObj->pListItems;
			while ( pListItem )
			{
				pCombo->AddItem(pListItem->szItemText, NULL);
				pListItem = pListItem->pNext;
			}

			pCombo->ActivateItemByRow((int)pObj->fdefValue);

			pCtrl->pControl = (Panel *)pCombo;
			break;
		default:
			break;
		}

		if ( pCtrl->type != O_BOOL )
		{
			pCtrl->pPrompt = new vgui::Label( pCtrl, "DescLabel", "" );
			pCtrl->pPrompt->SetContentAlignment( vgui::Label::a_west );
			pCtrl->pPrompt->SetTextInset( 5, 0 );
			pCtrl->pPrompt->SetText( pObj->prompt );
		}

		pCtrl->pScrObj = pObj;
		pCtrl->SetSize( 100, 28 );
		//pCtrl->SetBorder( scheme()->GetBorder(1, "DepressedButtonBorder") );
		m_pOptionsList->AddItem( pCtrl );

		// Link it in
		if ( !m_pList )
		{
			m_pList = pCtrl;
			pCtrl->next = NULL;
		}
		else
		{
			mpcontrol_t *p;
			p = m_pList;
			while ( p )
			{
				if ( !p->next )
				{
					p->next = pCtrl;
					pCtrl->next = NULL;
					break;
				}
				p = p->next;
			}
		}

		pObj = pObj->pNext;
	}
}
void EditorTextureImportDialog::_import() {


//	ImportMonitorBlock imb;

	Vector<String> files=import_path->get_text().split(",");

	if (!files.size()) {

		error_dialog->set_text("Please specify some files!");
		error_dialog->popup_centered(Size2(200,100));
		return;
	}

	String dst_path=save_path->get_text();

	if (save_path->get_text().strip_edges()=="") {
		error_dialog->set_text("Target path is empty.");
		error_dialog->popup_centered_minsize();
		return;
	}

	if (!save_path->get_text().begins_with("res://")) {
		error_dialog->set_text("Target path must be full resource path.");
		error_dialog->popup_centered_minsize();
		return;
	}


	if (!atlas && !large && !DirAccess::exists(save_path->get_text())) {
		error_dialog->set_text("Target path must exist.");
		error_dialog->popup_centered_minsize();
		return;
	}

	if (atlas) { //atlas

		if (files.size()==0) {

			error_dialog->set_text("At least one file needed for Atlas.");
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
		String dst_file = dst_path;
		//dst_file=dst_file.basename()+".tex";
		Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
		//imd->set_editor();
		for(int i=0;i<files.size();i++) {
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
		}
		imd->set_option("format",texture_options->get_format());
		imd->set_option("flags",texture_options->get_flags());
		imd->set_option("quality",texture_options->get_quality());
		imd->set_option("atlas",true);
		imd->set_option("atlas_size",int(size->get_val()));
		imd->set_option("large",false);
		imd->set_option("crop",crop_source->is_pressed());

		Error err = plugin->import(dst_file,imd);
		if (err) {

			error_dialog->set_text("Error importing: "+dst_file.get_file());
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
	} else if (large) { //atlas

		if (files.size()!=1) {

			error_dialog->set_text("Only one file is required for large texture");
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
		String dst_file = dst_path;
		//dst_file=dst_file.basename()+".tex";
		Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
		//imd->set_editor();
		for(int i=0;i<files.size();i++) {
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
		}
		imd->set_option("format",texture_options->get_format());
		imd->set_option("flags",texture_options->get_flags());
		imd->set_option("quality",texture_options->get_quality());
		imd->set_option("atlas",false);
		imd->set_option("large",true);
		imd->set_option("large_cell_size",int(size->get_val()));
		imd->set_option("crop",crop_source->is_pressed());

		Error err = plugin->import(dst_file,imd);
		if (err) {

			error_dialog->set_text("Error importing: "+dst_file.get_file());
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
	} else {


		for(int i=0;i<files.size();i++) {

			String dst_file = dst_path.plus_file(files[i].get_file());
			dst_file=dst_file.basename()+".tex";
			Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
			//imd->set_editor();
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
			imd->set_option("format",texture_options->get_format());
			imd->set_option("flags",texture_options->get_flags());
			imd->set_option("quality",texture_options->get_quality());
			imd->set_option("atlas",false);
			imd->set_option("large",false);

			Error err = plugin->import(dst_file,imd);
			if (err) {

				error_dialog->set_text("Error importing: "+dst_file.get_file());
				error_dialog->popup_centered(Size2(200,100));
				return;

			}
		}
	}

	hide();
}
	EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) {

		plugin=p_plugin;


		set_title(TTR("Import Translation"));

		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);



		VBoxContainer *csvb = memnew( VBoxContainer );

		HBoxContainer *hbc = memnew( HBoxContainer );
		csvb->add_child(hbc);
		vbc->add_margin_child(TTR("Source CSV:"),csvb);

		import_path = memnew( LineEdit );
		import_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(import_path);
		ignore_first = memnew( CheckButton );
		ignore_first->set_text(TTR("Ignore First Row"));
		csvb->add_child(ignore_first);

		Button * import_choose = memnew( Button );
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this,"_browse");

		VBoxContainer *tcomp = memnew( VBoxContainer);
		hbc = memnew( HBoxContainer );
		tcomp->add_child(hbc);
		vbc->add_margin_child(TTR("Target Path:"),tcomp);

		save_path = memnew( LineEdit );
		save_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(save_path);

		Button * save_choose = memnew( Button );
		save_choose->set_text(" .. ");
		hbc->add_child(save_choose);

		save_choose->connect("pressed", this,"_browse_target");

		compress = memnew( CheckButton);
		compress->set_pressed(true);
		compress->set_text(TTR("Compress"));
		tcomp->add_child(compress);

		add_to_project = memnew( CheckButton);
		add_to_project->set_pressed(true);
		add_to_project->set_text(TTR("Add to Project (engine.cfg)"));
		tcomp->add_child(add_to_project);

		file_select = memnew(EditorFileDialog);
		file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
		file_select->connect("file_selected", this,"_choose_file");
		file_select->add_filter("*.csv ; Translation CSV");
		save_select = memnew(	EditorDirDialog );
		add_child(save_select);

	//	save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
		save_select->connect("dir_selected", this,"_choose_save_dir");

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text(TTR("Import"));


		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text(TTR("Accept"));
	//	error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);

		columns = memnew( Tree );
		vbc->add_margin_child(TTR("Import Languages:"),columns,true);
	}
void EditorTextureImportDialog::_import() {


//	ImportMonitorBlock imb;

	Vector<String> files=import_path->get_text().split(",");

	if (!files.size()) {

		error_dialog->set_text("Please specify some files!");
		error_dialog->popup_centered(Size2(200,100));
		return;
	}

	String dst_path=save_path->get_text();

	if (dst_path.empty()) {

		error_dialog->set_text("Please specify a valid target import path!");
		error_dialog->popup_centered(Size2(200,100));
		return;

	}

	if (atlas) { //atlas

		if (files.size()==0) {

			error_dialog->set_text("At least one file needed for Atlas.");
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
		String dst_file = dst_path;
		//dst_file=dst_file.basename()+".tex";
		Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
		//imd->set_editor();
		for(int i=0;i<files.size();i++) {
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
		}
		imd->set_option("format",texture_options->get_format());
		imd->set_option("flags",texture_options->get_flags());
		imd->set_option("quality",texture_options->get_quality());
		imd->set_option("atlas",true);
		imd->set_option("crop",crop_source->is_pressed());

		Error err = plugin->import(dst_file,imd);
		if (err) {

			error_dialog->set_text("Error importing: "+dst_file.get_file());
			error_dialog->popup_centered(Size2(200,100));
			return;

		}

	} else {


		for(int i=0;i<files.size();i++) {

			String dst_file = dst_path.plus_file(files[i].get_file());
			dst_file=dst_file.basename()+".tex";
			Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
			//imd->set_editor();
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
			imd->set_option("format",texture_options->get_format());
			imd->set_option("flags",texture_options->get_flags());
			imd->set_option("quality",texture_options->get_quality());
			imd->set_option("atlas",false);
			Error err = plugin->import(dst_file,imd);
			if (err) {

				error_dialog->set_text("Error importing: "+dst_file.get_file());
				error_dialog->popup_centered(Size2(200,100));
				return;

			}
		}
	}

	hide();
}
示例#21
0
void DClusterSetManagerPage::appendManagerToList(DClusterUserInfo *info)
{
    if(info->getUserRole() == Mi::SySManager || info->getUserRole() == Mi::SeniorManager)
    {
        CheckButton* btn = new CheckButton(this);
        btn->setUserID(info->getUserID());
        btn->setUserName(info->getUserName());
        btn->setClusterID(info->getClusterID());

        if(info->getUserRole() == Mi::SySManager){
            btn->setReviewText(tr("群主"));
            btn->setReviewEnable(false);
        }else{
            btn->setReviewText(tr("取消管理员"));
            connect(btn, SIGNAL(reviewClicked()), this, SLOT(on_btnCancelManager_clicked()));
        }

        QPixmap pixmap(ImagePath::USER_PORTRAIT);
        pixmap.setDevicePixelRatio(2.0);
        btn->setPixMap(pixmap);
        btn->setFixedHeight(this->screenHeight()*0.1);
        btn->setFixedWidth(this->screenWidth());
        btn->setAttribute(Qt::WA_LayoutUsesWidgetRect);
        btn->setStyleSheet(SheetStyle::CHECKBUTTON_BOTTOM_BORDER);
        btnCheckList.insert(info->getUserID(), btn);

        if(managerLayout->count() == 0){
            managerLayout->addWidget(btn);
            managerLayout->addStretch(0);
        }
        else{
            if(info->getUserRole() == Mi::SySManager)
                managerLayout->insertWidget(0, btn);
            else
                managerLayout->insertWidget(managerLayout->count() - 1, btn);
        }
    }
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CMultiplayerAdvancedDialog::GatherCurrentValues()
{
	if ( !m_pDescription )
		return;

	// OK
	CheckButton *pBox;
	TextEntry *pEdit;
	ComboBox *pCombo;

	mpcontrol_t *pList;

	CScriptObject *pObj;
	CScriptListItem *pItem;

	char szValue[256];
	char strValue[ 256 ];

	pList = m_pList;
	while ( pList )
	{
		pObj = pList->pScrObj;

		if ( !pList->pControl )
		{
			pObj->SetCurValue( pObj->defValue );
			pList = pList->next;
			continue;
		}

		switch ( pObj->type )
		{
		case O_BOOL:
			pBox = (CheckButton *)pList->pControl;
			sprintf( szValue, "%s", pBox->IsSelected() ? "1" : "0" );
			break;
		case O_NUMBER:
			pEdit = ( TextEntry * )pList->pControl;
			pEdit->GetText( strValue, sizeof( strValue ) );
			sprintf( szValue, "%s", strValue );
			break;
		case O_STRING:
			pEdit = ( TextEntry * )pList->pControl;
			pEdit->GetText( strValue, sizeof( strValue ) );
			sprintf( szValue, "%s", strValue );
			break;
		case O_LIST:
			pCombo = (ComboBox *)pList->pControl;
			// pCombo->GetText( strValue, sizeof( strValue ) );
			int activeItem = pCombo->GetActiveItem();
			
			pItem = pObj->pListItems;
//			int n = (int)pObj->fdefValue;

			while ( pItem )
			{
				if (!activeItem--)
					break;

				pItem = pItem->pNext;
			}

			if ( pItem )
			{
				sprintf( szValue, "%s", pItem->szValue );
			}
			else  // Couln't find index
			{
				//assert(!("Couldn't find string in list, using default value"));
				sprintf( szValue, "%s", pObj->defValue );
			}
			break;
		}

		// Remove double quotes and % characters
		UTIL_StripInvalidCharacters( szValue, sizeof(szValue) );

		strcpy( strValue, szValue );

		pObj->SetCurValue( strValue );

		pList = pList->next;
	}
}
result ConfigForm::Construct(IActionEventListener * mainListener)
{
    VerticalBoxLayout layout;
    layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
    Form::Construct(layout, FORM_STYLE_NORMAL | FORM_STYLE_FOOTER);

    Label * label = new Label();
    label->Construct(Rectangle(0, 0, 48, 50), L"Device model:");
    AddControl(*label);
    layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED);

    __pModelEditField = new EditField;
    __pModelEditField->Construct(Rectangle(0, 0, 150, 110), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN);
    __pModelEditField->SetText(L"GT-I8800");
    AddControl(*__pModelEditField);
    layout.SetHorizontalFitPolicy(*__pModelEditField, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*__pModelEditField, FIT_POLICY_FIXED);

    label = new Label();
    label->Construct(Rectangle(0, 0, 48, 50), L"MNC:");
    AddControl(*label);
    layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED);

    __pMncEditField = new EditField;
    __pMncEditField->Construct(Rectangle(0, 0, 150, 110), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_FULLSCREEN);
    AddControl(*__pMncEditField);
    layout.SetHorizontalFitPolicy(*__pMncEditField, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*__pMncEditField, FIT_POLICY_FIXED);
    __pMncEditField->SetText(L"01");

    label = new Label();
    label->Construct(Rectangle(0, 0, 48, 50), L"Developer flag:");
    AddControl(*label);
    layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED);

    __pDevRadioGroup = new RadioGroup;
    __pDevRadioGroup->Construct();
    CheckButton * devbutton = new CheckButton;
    devbutton->Construct(Rectangle(0, 0, 150, 110), CHECK_BUTTON_STYLE_RADIO, BACKGROUND_STYLE_DEFAULT, false, "Developer mode, always success");
    devbutton->SetActionId(BuyConfigInfo::AlwaysSuccess, BuyConfigInfo::AlwaysSuccess);
    devbutton->AddActionEventListener(*this);
    AddControl(*devbutton);
    __pDevRadioGroup->Add(*devbutton);
    layout.SetHorizontalFitPolicy(*devbutton, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*devbutton, FIT_POLICY_FIXED);
    AppLog("chkbtn %p", devbutton);

    __pDevRadioGroup->SetSelectedItem(*devbutton);

    devbutton = new CheckButton;
    devbutton->Construct(Rectangle(0, 0, 150, 110), CHECK_BUTTON_STYLE_RADIO, BACKGROUND_STYLE_DEFAULT, false, "Normal");
    devbutton->SetActionId(BuyConfigInfo::Normal, BuyConfigInfo::Normal);
    devbutton->AddActionEventListener(*this);
    AddControl(*devbutton);
    __pDevRadioGroup->Add(*devbutton);
    layout.SetHorizontalFitPolicy(*devbutton, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*devbutton, FIT_POLICY_FIXED);
    AddControl(*__pDevRadioGroup);
    AppLog("chkbtn %p", devbutton);

    TableView * pTableView = new TableView();
    pTableView->Construct( Rectangle(0, 0, GetWidth(), 600), false, TABLE_VIEW_SCROLL_BAR_STYLE_NONE);
    AddControl(*pTableView);
    m_pTableView = pTableView;
    pTableView->SetItemProvider(this);
    pTableView->AddTableViewItemEventListener(*this);
    layout.SetHorizontalFitPolicy(*pTableView, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*pTableView, FIT_POLICY_FIXED);

    GetFooter()->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
    GetFooter()->AddActionEventListener(*this);

    __pMainListener = mainListener;

    BuyConfigInfo info;
    info.m_developerFlag = BuyConfigInfo::AlwaysSuccess;
    info.m_model = "GT-I8800";
    info.m_mcc = "000";
    info.m_mnc = "00";
    __pEngine = new BuyEngine(this, info);

    result r = __pEngine->RequestCountryList(0);
    if ( IsFailed(r) ) AppLog(GetErrorMessage(r));

    UpdateConfirmButtonState();

    return E_SUCCESS;
}
示例#24
0
文件: options.cpp 项目: EQ4/seq42
options::options (Gtk::Window & parent, perform * a_p):
    Gtk::Dialog ("Options", parent, true, true)
{
    m_perf = a_p;
    VBox *vbox = NULL;
    
    HBox *hbox = manage (new HBox ());
    get_vbox ()->pack_start (*hbox, false, false);

    get_action_area ()->set_border_width (2);
    hbox->set_border_width (6);

    m_button_ok = manage (new Button ("Ok"));
    get_action_area ()->pack_end (*m_button_ok, false, false);
    m_button_ok->signal_clicked ().connect (mem_fun (*this, &options::hide));


    m_notebook = manage (new Notebook ());
    hbox->pack_start (*m_notebook);

    // Clock  Buses
    int buses = m_perf->get_master_midi_bus ()->get_num_out_buses ();
    //Notebook *clock_notebook = manage( new Notebook());
    //clock_notebook->set_scrollable(true);

    vbox = manage(new VBox());
    m_notebook->pages().push_back(Notebook_Helpers::TabElem(*vbox,
                "MIDI Clock"));

    CheckButton *check;
    Label *label;
    
    Gtk::Tooltips * tooltips = manage (new Tooltips ());

    for (int i = 0; i < buses; i++)
    {  
        HBox *hbox2 = manage (new HBox ());
        label = manage( new Label(m_perf->get_master_midi_bus ()->
                                            get_midi_out_bus_name (i), 0));

        hbox2->pack_start (*label, false, false);
        
        
        Gtk::RadioButton * rb_off = manage (new RadioButton ("Off"));
        add_tooltip( rb_off, "Midi Clock will be disabled.");
        
        Gtk::RadioButton * rb_on = manage (new RadioButton ("On (Pos)"));
        add_tooltip( rb_on,
                "Midi Clock will be sent. Midi Song Position and Midi Continue will be sent if starting greater than tick 0 in song mode, otherwise Midi Start is sent.");

        Gtk::RadioButton * rb_mod = manage (new RadioButton ("On (Mod)"));
        add_tooltip( rb_mod, "Midi Clock will be sent.  Midi Start will be sent and clocking will begin once the song position has reached the modulo of the specified Size. (Used for gear that doesn't respond to Song Position)");

        Gtk::RadioButton::Group group = rb_off->get_group ();
        rb_on->set_group (group);
        rb_mod->set_group (group);

        rb_off->signal_toggled().connect (sigc::bind(mem_fun (*this, &options::clock_callback_off), i, rb_off ));
        rb_on->signal_toggled ().connect (sigc::bind(mem_fun (*this, &options::clock_callback_on),  i, rb_on  ));
        rb_mod->signal_toggled().connect (sigc::bind(mem_fun (*this, &options::clock_callback_mod), i, rb_mod ));
        
        hbox2->pack_end (*rb_mod, false, false ); 
        hbox2->pack_end (*rb_on, false, false);
        hbox2->pack_end (*rb_off, false, false);

        vbox->pack_start( *hbox2, false, false );
       
        switch ( m_perf->get_master_midi_bus ()->get_clock (i))
        {
            case e_clock_off: rb_off->set_active(1); break;
            case e_clock_pos: rb_on->set_active(1); break;
            case e_clock_mod: rb_mod->set_active(1); break;
        }
                              
        // SET DEFAULT STATES check->set_active (m_perf->get_master_midi_bus ()->get_clock (i));
    }

    Adjustment *clock_mod_adj = new Adjustment( midibus::get_clock_mod(), 1, 16 << 10, 1 );
    SpinButton *clock_mod_spin = new SpinButton( *clock_mod_adj );

    HBox *hbox2 = manage (new HBox ());
    
    //m_spinbutton_bpm->set_editable( false );
    hbox2->pack_start(*(manage( new Label( "Clock Start Modulo (1/16 Notes)"))), false, false, 4);
    hbox2->pack_start(*clock_mod_spin, false, false );

    vbox->pack_start( *hbox2, false, false );
    
    clock_mod_adj->signal_value_changed().connect( sigc::bind(mem_fun(*this,&options::clock_mod_callback),clock_mod_adj));

    // add controls for input method
    {
        Adjustment *adj = new Adjustment( global_interactionmethod, 0, e_number_of_interactions-1, 1 );
        SpinButton *spin = new SpinButton( *adj );

        HBox *hbox2 = manage (new HBox ());
        HBox *hbox3 = manage (new HBox ());

        //m_spinbutton_bpm->set_editable( false );
        interaction_method_label = new Label("Input Method");
        hbox2->pack_start(*(manage( interaction_method_label )), false, false, 4);
        hbox2->pack_start(*spin, false, false );

        vbox->pack_start( *hbox2, false, false );

        interaction_method_desc_label = new Label(" ----- ");
        hbox3->pack_start(*(manage( interaction_method_desc_label )), false, false, 4);
        vbox->pack_start(*hbox3, false, false );

        adj->signal_value_changed().connect( sigc::bind(mem_fun(*this,&options::interaction_method_callback),adj));

        // force it to refresh.
        interaction_method_callback( adj );
    }

    // Input Buses
    buses = m_perf->get_master_midi_bus ()->get_num_in_buses ();

    vbox = manage (new VBox ());
    m_notebook->pages ().
        push_back (Notebook_Helpers::TabElem (*vbox, "MIDI Input"));

    for (int i = 0; i < buses; i++)
    {

        check =
            manage (new
                    CheckButton (m_perf->get_master_midi_bus ()->
                        get_midi_in_bus_name (i), 0));
        check->signal_toggled ().
            connect (bind (mem_fun (*this, &options::input_callback), i, check));
        check->set_active (m_perf->get_master_midi_bus ()->get_input (i));

        vbox->pack_start (*check, false, false);
    }

    // KeyBoard keybinding setup (editor for .seq42rc keybindings.
    vbox = manage (new VBox ());
    m_notebook->pages ().push_back (Notebook_Helpers::TabElem (*vbox, "Keyboard"));
    {
        Label* label;
        KeyBindEntry* entry;
        HBox *hbox;

        #define AddKey(text, integer) \
            label = manage (new Label( text )); \
            hbox->pack_start (*label, false, false, 4); \
            entry = manage (new KeyBindEntry( &integer )); \
            hbox->pack_start (*entry, false, false, 4);

        hbox = manage (new HBox ());
        AddKey( "start:", m_perf->m_key_start );
        AddKey( "stop:", m_perf->m_key_stop );
        AddKey( "toggle looping:", m_perf->m_key_loop );
        vbox->pack_start (*hbox, false, false);

        hbox = manage (new HBox ());
        AddKey( "bpm dn:", m_perf->m_key_bpm_dn );
        AddKey( "bpm up:", m_perf->m_key_bpm_up );
        vbox->pack_start (*hbox, false, false);

        #undef AddKey
    }

    // Jack
#ifdef JACK_SUPPORT
    VBox *vbox2 = manage (new VBox ());
    vbox2->set_border_width (4);
    m_notebook->pages().push_back(Notebook_Helpers::TabElem(*vbox2,
                "Jack Sync"));

    check = manage (new CheckButton ("Jack Transport"));
    check->set_active (global_with_jack_transport);
    add_tooltip( check, "Enable sync with JACK Transport.");
    check->signal_toggled ().
        connect (bind
                (mem_fun (*this, &options::transport_callback), e_jack_transport,
                 check));
    vbox2->pack_start (*check, false, false);

    check = manage (new CheckButton ("Transport Master"));
    check->set_active (global_with_jack_master);
    add_tooltip( check, "Seq42 will attempt to serve as JACK Master.");
    check->signal_toggled ().
        connect (bind
                (mem_fun (*this, &options::transport_callback), e_jack_master,
                 check));

    vbox2->pack_start (*check, false, false);

    check = manage (new CheckButton ("Master Conditional"));
    check->set_active (global_with_jack_master_cond);
    add_tooltip( check,
            "Seq42 will fail to be master if there is already a master set.");
    check->signal_toggled ().
        connect (bind
                (mem_fun (*this, &options::transport_callback), e_jack_master_cond,
                 check));

    vbox2->pack_start (*check, false, false);


    Gtk::Button * button = manage (new Button ("Connect"));
    add_tooltip( button, "Connect to Jack.");
    button->signal_clicked().connect(bind(mem_fun(*this,
                    &options::transport_callback), e_jack_connect, button));
    vbox2->pack_start (*button, false, false);

    button = manage (new Button ("Disconnect"));
    add_tooltip( button, "Disconnect Jack.");
    button->signal_clicked().connect(bind(mem_fun(*this,
                    &options::transport_callback), e_jack_disconnect, button));
    vbox2->pack_start (*button, false, false);
#endif

    /* show everything */
    show_all_children ();
}
示例#25
0
void Dialog::editPort(){
    if( !desktop ) {
        std::cerr << "No desktop found.\n";
        return;
    }
    try {
        myDialogComponent = loadGUIFile( "gui/portdialog.xml" );
        assert( myDialogComponent != 0);
        registerDialog();
        blockingDialogIsOpen = true;
        iAmBlocking = true;
    } catch(std::exception& e) {
        std::cerr << "Couldn't display dialog 'tradedialog.xml': "
            << e.what() << "\n";
        return;
    }
    // set Dialog to Port-Data
    Paragraph* p = getParagraph( *myDialogComponent, "DialogTitle" );
    std::stringstream title;
	title << _("Port") << " ( " << pointX <<" , " << pointY << " )";
    p->setText( title.str() );

    CheckButton* cb;
    cb = getCheckButton( *myDialogComponent, "BuyFood" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MB_FOOD) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellFood" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MS_FOOD) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuyCoal" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MB_COAL) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellCoal" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MS_COAL) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuyOre" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MB_ORE) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellOre" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MS_ORE) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuyGoods" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MB_GOODS) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellGoods" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MS_GOODS) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuySteel" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MB_STEEL) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellSteel" );
    if( MP_INFO( pointX,pointY ).flags & FLAG_MS_STEEL) cb->check(); else cb->uncheck();
    // connect signals
    Button* applyButton = getButton( *myDialogComponent, "Apply" );
    applyButton->clicked.connect( makeCallback(*this, &Dialog::applyPortButtonClicked ) );
    Button* gotoButton = getButton( *myDialogComponent, "goto" );
    gotoButton->clicked.connect( makeCallback( *this, &Dialog::gotoButtonClicked ) );
}
示例#26
0
void Dialog::editPort(){
    if( !desktop ) {
        std::cerr << "No desktop found.\n";
        return;
    }
    try {
        myDialogComponent = loadGUIFile( "gui/portdialog.xml" );
        assert( myDialogComponent != 0);
        registerDialog();
        blockingDialogIsOpen = true;
        iAmBlocking = true;
    } catch(std::exception& e) {
        std::cerr << "Couldn't display dialog 'tradedialog.xml': "
            << e.what() << "\n";
        return;
    }
    // set Dialog to Port-Data
    //int port_flags = world(pointX, pointY)->reportingConstruction->flags;
    Port *port = dynamic_cast<Port *>(world(pointX, pointY)->reportingConstruction);
    Paragraph* p = getParagraph( *myDialogComponent, "DialogTitle" );
    std::stringstream title;
    title << _("Port") << " ( " << pointX <<" , " << pointY << " )";
    p->setText( title.str() );

    CheckButton* cb;
    cb = getCheckButton( *myDialogComponent, "BuyFood" );
    if( port->commodityRuleCount[Construction::STUFF_FOOD].take) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellFood" );
    if( port->commodityRuleCount[Construction::STUFF_FOOD].give) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuyCoal" );
    if( port->commodityRuleCount[Construction::STUFF_COAL].take) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellCoal" );
    if( port->commodityRuleCount[Construction::STUFF_COAL].give) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuyOre" );
    if( port->commodityRuleCount[Construction::STUFF_ORE].take) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellOre" );
    if( port->commodityRuleCount[Construction::STUFF_ORE].give) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuyGoods" );
    if( port->commodityRuleCount[Construction::STUFF_GOODS].take) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellGoods" );
    if( port->commodityRuleCount[Construction::STUFF_GOODS].give) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "BuySteel" );
    if( port->commodityRuleCount[Construction::STUFF_STEEL].take) cb->check(); else cb->uncheck();
    cb = getCheckButton( *myDialogComponent, "SellSteel" );
    if( port->commodityRuleCount[Construction::STUFF_STEEL].give) cb->check(); else cb->uncheck();
    // connect signals
    Button* applyButton = getButton( *myDialogComponent, "Apply" );
    applyButton->clicked.connect( makeCallback(*this, &Dialog::applyPortButtonClicked ) );
    Button* gotoButton = getButton( *myDialogComponent, "goto" );
    gotoButton->clicked.connect( makeCallback( *this, &Dialog::gotoButtonClicked ) );
}
//---------------------------------------------------------------------------------------
void GrpRhythmicDictation::create_controls_in_group(wxBoxSizer* pMainSizer)
{
    //create the common controls for a group
    set_group_title(_("Rhythmic dictation tools"));
    wxBoxSizer* pCtrolsSizer = create_main_sizer_for_group(pMainSizer);

    //create the specific controls for this group

    //buttons for adding notes
        //whole note/rest
	wxBoxSizer* pRow1Sizer = new wxBoxSizer( wxHORIZONTAL );

    wxSize btSize(24, 24);
    CheckButton* pButton;
	pButton = new CheckButton(this, k_id_button_note, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("tie", "", btSize);
    pButton->SetBitmapDown("tie", "button_selected_flat", btSize);
    pButton->SetBitmapOver("tie", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("tie_dis", "", btSize);
    pButton->SetToolTip(_("Add/remove a tie to/from selected notes"));
	pRow1Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

        //half note/rest
	pButton = new CheckButton(this, k_id_button_note+1, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("tuplet", "", btSize);
    pButton->SetBitmapDown("tuplet", "button_selected_flat", btSize);
    pButton->SetBitmapOver("tuplet", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("tuplet_dis", "", btSize);
    pButton->SetToolTip(_("Add/remove tuplet to/from selected notes"));
	pRow1Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

        //quarter note/rest
	pButton = new CheckButton(this, k_id_button_note+2, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("toggle_stem", "", btSize);
    pButton->SetBitmapDown("toggle_stem", "button_selected_flat", btSize);
    pButton->SetBitmapOver("toggle_stem", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("toggle_stem_dis", "", btSize);
    pButton->SetToolTip(_("Toggle stem in selected notes"));
	pRow1Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

    pCtrolsSizer->Add( pRow1Sizer, 0, wxEXPAND, 5 );
    //    wxButton* pButton;
    //    for (int i=0; i < 4; ++i)
    //    {
    //        pButton = LENMUS_NEW wxButton(this, k_id_button_0 + i, _("11"));
    //    //        m_clefs[i] = LENMUS_NEW wxBitmapButton(this, k_id_button+i, create_bitmap(i),
    //    //                                               wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
    //        pCtrolsSizer->Add( pButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
    //    }

	//buttons for moving cursor
	wxBoxSizer* pRow2Sizer = new wxBoxSizer( wxHORIZONTAL );

	pButton = new CheckButton(this, k_id_button_cursor, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("toggle_stem", "", btSize);
    pButton->SetBitmapDown("toggle_stem", "button_selected_flat", btSize);
    pButton->SetBitmapOver("toggle_stem", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("toggle_stem_dis", "", btSize);
    pButton->SetToolTip(_("Toggle stem in selected notes"));
	pRow2Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

    pCtrolsSizer->Add( pRow2Sizer, 0, wxEXPAND, 5 );

	//other commands: backdelete, delete & insert barline

	//push button for dots

	this->Layout();
}
//-----------------------------------------------------------------------------
// Purpose: applies all the values in the page
//-----------------------------------------------------------------------------
void CCreateMultiplayerGameGameplayPage::GatherCurrentValues()
{
	if ( !m_pDescription )
		return;

	// OK
	CheckButton *pBox;
	TextEntry *pEdit;
	ComboBox *pCombo;

	mpcontrol_t *pList;

	CScriptObject *pObj;
	CScriptListItem *pItem;

	char szValue[256];
	char strValue[ 256 ];

	pList = m_pList;
	while ( pList )
	{
		pObj = pList->pScrObj;

		if ( !pList->pControl )
		{
			pObj->SetCurValue( pObj->defValue );
			pList = pList->next;
			continue;
		}

		switch ( pObj->type )
		{
		case O_BOOL:
			pBox = (CheckButton *)pList->pControl;
			sprintf( szValue, "%s", pBox->IsSelected() ? "1" : "0" );
			break;
		case O_NUMBER:
			pEdit = ( TextEntry * )pList->pControl;
			pEdit->GetText( strValue, sizeof( strValue ) );
			sprintf( szValue, "%s", strValue );
			break;
		case O_STRING:
			pEdit = ( TextEntry * )pList->pControl;
			pEdit->GetText( strValue, sizeof( strValue ) );
			sprintf( szValue, "%s", strValue );
			break;
		case O_LIST:
			pCombo = ( ComboBox *)pList->pControl;
			pCombo->GetText( strValue, sizeof( strValue ) );
			
			pItem = pObj->pListItems;
			int n = (int)pObj->fdefValue;

			while ( pItem )
			{
				if ( !stricmp( pItem->szItemText, strValue ) )
				{
					break;
				}
				pItem = pItem->pNext;
			}

			if ( pItem )
			{
				sprintf( szValue, "%s", pItem->szValue );
			}
			else  //Couln't find index
			{
				sprintf( szValue, "%s", pObj->defValue );
			}
			break;
		}

		// Remove double quotes and % characters
		UTIL_StripInvalidCharacters( szValue );

		strcpy( strValue, szValue );

		pObj->SetCurValue( strValue );

		pList = pList->next;
	}
}
	void _choose_file(const String& p_path) {

		import_path->set_text(p_path);
		FileAccess *f = FileAccess::open(p_path,FileAccess::READ);
		if (!f) {

			error_dialog->set_text(TTR("Invalid source!"));
			error_dialog->popup_centered(Size2(200,100));
			return;

		}

		Vector<String> csvh = f->get_csv_line();
		memdelete(f);

		if (csvh.size()<2) {

			error_dialog->set_text(TTR("Invalid translation source!"));
			error_dialog->popup_centered(Size2(200,100));
			return;

		}

		columns->clear();
		columns->set_columns(2);
		TreeItem *root = columns->create_item();
		columns->set_hide_root(true);
		columns->set_column_titles_visible(true);
		columns->set_column_title(0,TTR("Column"));
		columns->set_column_title(1,TTR("Language"));
		Vector<String> langs = TranslationServer::get_all_locales();
		Vector<String> names = TranslationServer::get_all_locale_names();
		if (csvh[0]=="")
			ignore_first->set_pressed(true);


		items.clear();

		for(int i=1;i<csvh.size();i++) {

			TreeItem *ti = columns->create_item(root);

			ti->set_editable(0,true);
			ti->set_selectable(0,false);
			ti->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
			ti->set_checked(0,true);
			ti->set_text(0,itos(i));
			items.push_back(ti);

			String lname = csvh[i].to_lower().strip_edges();
			int idx=-1;
			String hint;
			for(int j=0;j<langs.size();j++) {

				if (langs[j]==lname.substr(0,langs[j].length()).to_lower()) {
					idx=j;
				}
				if (j>0) {
					hint+=",";
				}
				hint+=names[j].replace(","," ");
			}

			ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE);
			ti->set_text(1,hint);
			ti->set_editable(1,true);


			if (idx!=-1) {
				ignore_first->set_pressed(true);
				ti->set_range(1,idx);
			} else {

				//not found, maybe used stupid name
				if (lname.begins_with("br")) //brazilian
					ti->set_range(1,langs.find("pt"));
				else if (lname.begins_with("ch")) //chinese
					ti->set_range(1,langs.find("zh"));
				else if (lname.begins_with("sp")) //spanish
					ti->set_range(1,langs.find("es"));
				else if (lname.begins_with("kr"))// kprean
					ti->set_range(1,langs.find("ko"));
				else if (i==0)
					ti->set_range(1,langs.find("en"));
				else
					ti->set_range(1,langs.find("es"));
			}

			ti->set_metadata(1,names[ti->get_range(1)]);
		}



	}
示例#30
0
void MainMenu::fillNewGameMenu()
{
  const std::string buttonNames[]={"File0","File1","File2","File3","File4","File5"};

  char **files= PHYSFS_enumerateFiles("opening");

  char **fptr=files;

  CheckButton *button;

  fileMap.clear();

  for(int i=0;i<6;i++)
  {
    button=getCheckButton(*newGameMenu.get(),buttonNames[i]);

    button->clicked.connect(makeCallback(*this,&MainMenu::selectLoadGameButtonClicked));
    while(*fptr)
    {
      if(std::string(*fptr).find(".scn")!=std::string::npos)
        break;
      fptr++;
    }
    if(*fptr)
    {
      std::string f=*fptr;
      if(f.length()>5){
        f=f.substr(0,f.length()-4); // truncate .scn
      }
      // save real name
      fileMap.insert(std::pair<std::string, std::string>(buttonNames[i], f ));
      // use translated name for caption
      button->setCaptionText(_(f.c_str()));
      fptr++;
    }
    else
      button->setCaptionText("");
  }
  PHYSFS_freeList(files);

  button=getCheckButton(*newGameMenu.get(),"WithVillage");
  button->check();
  //button->setCaptionText(_("random empty board"));
  //button->clicked.connect(makeCallback(*this,&MainMenu::selectLoadGameButtonClicked));

  button=getCheckButton(*newGameMenu.get(),"RiverDelta");
  button->setCaptionText(_("river delta"));
  button->clicked.connect(makeCallback(*this,&MainMenu::selectLoadGameButtonClicked));

  button=getCheckButton(*newGameMenu.get(),"DesertArea");
  button->setCaptionText(_("semi desert"));
  button->clicked.connect(makeCallback(*this,&MainMenu::selectLoadGameButtonClicked));

  button=getCheckButton(*newGameMenu.get(),"TemperateArea");
  button->setCaptionText(_("temperate"));
  button->clicked.connect(makeCallback(*this,&MainMenu::selectLoadGameButtonClicked));

  button=getCheckButton(*newGameMenu.get(),"SwampArea");
  button->setCaptionText(_("swamp"));
  button->clicked.connect(makeCallback(*this,&MainMenu::selectLoadGameButtonClicked));

  return;
  /* Is there a better way to add filenames to the directory? */
  _("good_times");
  _("bad_times");
  _("Beach");
  _("extreme_arid");
  _("extreme_wetland");
}