当前位置: 首页>>代码示例>>C++>>正文


C++ Fl_Menu_Button类代码示例

本文整理汇总了C++中Fl_Menu_Button的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Menu_Button类的具体用法?C++ Fl_Menu_Button怎么用?C++ Fl_Menu_Button使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Fl_Menu_Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: field_new_cb

static void field_new_cb(Fl_Widget *w, void *data)
{
  Fl_Menu_Button* mb = ((Fl_Menu_Button*)w);
  FieldManager *fields = GModel::current()->getFields();
  int id = fields->newId();
  add_field(id, mb->text(), GModel::current()->getFileName());
  if((*fields)[id])
    FlGui::instance()->fields->editField((*fields)[id]);
}
开发者ID:iyer-arvind,项目名称:gmsh,代码行数:9,代码来源:fieldWindow.cpp

示例2: Fl_Menu_Button

void gMidiChannel::__cb_openMenu() {

	Fl_Menu_Item rclick_menu[] = {
		{"Edit actions..."},                        // 0
		{"Clear actions", 0, 0, 0, FL_SUBMENU},     // 1
			{"All"},                                  // 2
			{0},                                      // 3
		{"Setup MIDI output..."},                   // 4
		{"Setup MIDI input..."},                    // 5
		{"Delete channel"},                         // 6
		{0}
	};

	/* no 'clear actions' if there are no actions */

	if (!ch->hasActions)
		rclick_menu[1].deactivate();

	Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50);
	b->box(G_BOX);
	b->textsize(11);
	b->textcolor(COLOR_TEXT_0);
	b->color(COLOR_BG_0);

	const Fl_Menu_Item *m = rclick_menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b);
	if (!m) return;

	if (strcmp(m->label(), "Delete channel") == 0) {
		if (!gdConfirmWin("Warning", "Delete channel: are you sure?"))
			return;
		glue_deleteChannel(ch);
		return;
	}

	if (strcmp(m->label(), "All") == 0) {
		if (!gdConfirmWin("Warning", "Clear all actions: are you sure?"))
			return;
		recorder::clearChan(ch->index);
		gu_refreshActionEditor(); // refresh a.editor window, it could be open
		return;
	}

	if (strcmp(m->label(), "Edit actions...") == 0) {
		gu_openSubWindow(mainWin, new gdActionEditor(ch),	WID_ACTION_EDITOR);
		return;
	}

	if (strcmp(m->label(), "Setup MIDI output...") == 0) {
		gu_openSubWindow(mainWin, new gdMidiInputSetup(ch), 0);
		return;
	}

	if (strcmp(m->label(), "Setup MIDI input...") == 0) {
		gu_openSubWindow(mainWin, new gdMidiGrabberChannel(ch), 0);
		return;
	}
}
开发者ID:micahscopes,项目名称:giada,代码行数:57,代码来源:gg_keyboard.cpp

示例3: _menu

Fl_Menu_Button &
Control_Sequence::menu ( void ) 
{
    static Fl_Menu_Button _menu( 0, 0, 0, 0, "Control Sequence" );

    _menu.clear();
    
    if ( mode() == OSC )
    {
        add_osc_peers_to_menu( &_menu, "Connect To" );
    }
    
    _menu.add( "Interpolation/None", 0, 0, 0, FL_MENU_RADIO | ( interpolation() == None ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Interpolation/Linear", 0, 0, 0, FL_MENU_RADIO | ( interpolation() == Linear ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Mode/Control Voltage (JACK)", 0, 0, 0 ,FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Mode/Control Signal (OSC)", 0, 0, 0 , FL_MENU_RADIO | ( mode() == OSC ? FL_MENU_VALUE : 0 ) );
    
    _menu.add( "Rename", 0, 0, 0 );
    _menu.add( "Color", 0, 0, 0 );
    _menu.add( "Remove", 0, 0, 0 );
    
    _menu.callback( &Control_Sequence::menu_cb, (void*)this);

    return _menu;
}
开发者ID:DatanoiseTV,项目名称:non,代码行数:25,代码来源:Control_Sequence.C

示例4: Fl_Menu_Button

void gdMainWindow::__cb_open_edit_menu() {
	Fl_Menu_Item menu[] = {
		{"Clear all samples"},
		{"Clear all actions"},
		{"Reset to init state"},
		{0}
	};

	/* clear all actions disabled if no recs, clear all samples disabled
	 * if no samples. */

	menu[1].deactivate();

	for (unsigned i=0; i<MAX_NUM_CHAN; i++)
		if (recorder::chanEvents[i]) {
			menu[1].activate();
			break;
		}
	for (unsigned i=0; i<MAX_NUM_CHAN; i++)
		if (G_Mixer.chan[i] != NULL) {
			menu[0].activate();
			break;
		}

	Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50);
	b->box(G_BOX);
	b->textsize(11);
	b->textcolor(COLOR_TEXT_0);
	b->color(COLOR_BG_0);

	const Fl_Menu_Item *m = menu->popup(Fl::event_x(),	Fl::event_y(), 0, 0, b);
	if (!m) return;

	if (strcmp(m->label(), "Clear all samples") == 0) {
		if (!gdConfirmWin("Warning", "Clear all samples: are you sure?"))
			return;
		delSubWindow(WID_SAMPLE_EDITOR);
		glue_clearAllSamples();
		return;
	}
	if (strcmp(m->label(), "Clear all actions") == 0) {
		if (!gdConfirmWin("Warning", "Clear all actions: are you sure?"))
			return;
		delSubWindow(WID_ACTION_EDITOR);
		glue_clearAllRecs();
		return;
	}
	if (strcmp(m->label(), "Reset to init state") == 0) {
		if (!gdConfirmWin("Warning", "Reset to init state: are you sure?"))
			return;
		gu_closeAllSubwindows();
		glue_resetToInitState();
		return;
	}
}
开发者ID:fourks,项目名称:giada,代码行数:55,代码来源:gd_mainWindow.cpp

示例5: cb_menu

void Fl_Tool_Bar::cb_menu(Fl_Widget *w, void *data)
{
    Fl_Menu_Button *m = (Fl_Menu_Button *)w;
    Fl_Widget *item = m->item();
    if (item && item->user_data()) {
        Fl_Widget *toolw = (Fl_Widget *)item->user_data();
        if(item->value()) toolw->set_value();
        else toolw->clear_value();
        toolw->do_callback();
    }
}
开发者ID:GustavoMOG,项目名称:efltk,代码行数:11,代码来源:Fl_Tool_Bar.cpp

示例6: field_put_on_view_cb

static void field_put_on_view_cb(Fl_Widget *w, void *data)
{
  Fl_Menu_Button* mb = ((Fl_Menu_Button*)w);
  Field *field = (Field*)FlGui::instance()->fields->editor_group->user_data();
  if(mb->value() == 0)
    field->putOnNewView();
  else if(mb->value() - 1 < (int)PView::list.size())
    field->putOnView(PView::list[mb->value() - 1]);
  FlGui::instance()->updateViews(mb->value() == 0, true);
  drawContext::global()->draw();
}
开发者ID:iyer-arvind,项目名称:gmsh,代码行数:11,代码来源:fieldWindow.cpp

示例7: Fl_Menu_Button

void gMenu::__cb_file()
{
	/* An Fl_Menu_Button is made of many Fl_Menu_Item */

	Fl_Menu_Item menu[] = {
		{"Open patch or project..."},
		{"Save patch..."},
		{"Save project..."},
		{"Quit Giada"},
		{0}
	};

	Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50);
	b->box(G_BOX);
	b->textsize(11);
	b->textcolor(COLOR_TEXT_0);
	b->color(COLOR_BG_0);

	const Fl_Menu_Item *m = menu->popup(Fl::event_x(),	Fl::event_y(), 0, 0, b);
	if (!m) return;


	if (strcmp(m->label(), "Open patch or project...") == 0) {
		gWindow *childWin = new gdBrowser("Load Patch", G_Conf.patchPath.c_str(), 0, BROWSER_LOAD_PATCH);
		gu_openSubWindow(mainWin, childWin, WID_FILE_BROWSER);
		return;
	}
	if (strcmp(m->label(), "Save patch...") == 0) {
		if (G_Mixer.hasLogicalSamples() || G_Mixer.hasEditedSamples())
			if (!gdConfirmWin("Warning", "You should save a project in order to store\nyour takes and/or processed samples."))
				return;
		gWindow *childWin = new gdBrowser("Save Patch", G_Conf.patchPath.c_str(), 0, BROWSER_SAVE_PATCH);
		gu_openSubWindow(mainWin, childWin, WID_FILE_BROWSER);
		return;
	}
	if (strcmp(m->label(), "Save project...") == 0) {
		gWindow *childWin = new gdBrowser("Save Project", G_Conf.patchPath.c_str(), 0, BROWSER_SAVE_PROJECT);
		gu_openSubWindow(mainWin, childWin, WID_FILE_BROWSER);
		return;
	}
	if (strcmp(m->label(), "Quit Giada") == 0) {
		mainWin->do_callback();
		return;
	}
}
开发者ID:DomiLou,项目名称:giada,代码行数:45,代码来源:gd_mainWindow.cpp

示例8: m

/** build the context menu for this control */
Fl_Menu_Button &
Controller_Module::menu ( void )
{
    static Fl_Menu_Button m( 0, 0, 0, 0, "Controller" );

    Fl_Menu_Item items[] =
        {
            { "Mode",             0, 0, 0,  FL_SUBMENU    },
            { "GUI + OSC",       0, 0, 0,  FL_MENU_RADIO | ( mode() == GUI ? FL_MENU_VALUE : 0 ) },
            { "Control Voltage (JACK)",           0, 0, 0,  FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ) },
            { 0 },
            { "Remove", 0, 0, 0, 0 },
            { 0 },
        };

    menu_set_callback( items, &Controller_Module::menu_cb, (void*)this );

    m.copy( items, (void*)this );

    return m;
}
开发者ID:shanipribadi,项目名称:non,代码行数:22,代码来源:Controller_Module.C

示例9: m

/** build the context menu for this control */
Fl_Menu_Button &
Controller_Module::menu ( void )
{
    static Fl_Menu_Button m( 0, 0, 0, 0, "Controller" );

    m.clear();

    if ( mode() == GUI )
    {
        add_osc_peers_to_menu( &m, "Connect To" );
        add_osc_connections_to_menu( &m, "Disconnect From" );
    }

    m.add( "Mode/GUI + OSC", 0, 0, 0,  FL_MENU_RADIO | ( mode() == GUI ? FL_MENU_VALUE : 0 ));
    m.add( "Mode/Control Voltage (JACK)", 0, 0, 0,  FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ));
    m.add( "Remove", 0, 0, 0, is_default() ? FL_MENU_INACTIVE : 0 );

//    menu_set_callback( m.items(), &Controller_Module::menu_cb, (void*)this );
    m.callback( &Controller_Module::menu_cb, (void*)this );
    //   m.copy( items, (void*)this );

    return m;
}
开发者ID:0mk,项目名称:non,代码行数:24,代码来源:Controller_Module.C

示例10: size

/** build the context menu */
Fl_Menu_Button &
Track::menu ( void ) const
{

    int c = output.size();
    int s = size();

    _menu.clear();

    _menu.add( "Takes/Show all takes", 0, 0, 0, FL_MENU_TOGGLE | ( show_all_takes() ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Takes/New", 0, 0, 0 );

    if ( takes->children() )
    {
        _menu.add( "Takes/Remove", 0, 0, 0 );
        _menu.add( "Takes/Remove others", 0, 0, 0, FL_MENU_DIVIDER );
        
        for ( int i = 0; i < takes->children(); ++i )
        {
            Sequence *s = (Sequence *)takes->child( i );
            
            char n[256];
            snprintf( n, sizeof(n), "Takes/%s", s->name() );

            _menu.add( n, 0, 0, s);
        }
    }

    _menu.add( "Type/Mono",  0, 0, 0, FL_MENU_RADIO | ( c == 1 ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Type/Stereo", 0, 0, 0, FL_MENU_RADIO | ( c == 2 ? FL_MENU_VALUE : 0 ));
    _menu.add( "Type/Quad",            0, 0, 0, FL_MENU_RADIO | ( c == 4 ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Type/...",             0, 0, 0, FL_MENU_RADIO | ( c == 3 || c > 4 ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Overlay controls",   0, 0, 0, FL_MENU_TOGGLE | ( overlay_controls() ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Add Control",     0, 0, 0 );
    _menu.add( "Add Annotation",  0, 0, 0 );
    _menu.add( "Color",           0, 0, 0 );
    _menu.add( "Rename",          FL_CTRL + 'n', 0, 0 );
    _menu.add( "Size/Small",           FL_ALT + '1', 0, 0, FL_MENU_RADIO | ( s == 0 ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Size/Medium",          FL_ALT + '2', 0, 0, FL_MENU_RADIO | ( s == 1 ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Size/Large",           FL_ALT + '3', 0, 0, FL_MENU_RADIO | ( s == 2 ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Size/Huge",           FL_ALT + '4', 0, 0, FL_MENU_RADIO | ( s == 3 ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Flags/Record",         FL_CTRL + 'r', 0, 0, FL_MENU_TOGGLE | ( armed() ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Flags/Mute",            FL_CTRL + 'm', 0, 0, FL_MENU_TOGGLE | ( mute() ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Flags/Solo",           FL_CTRL + 's', 0, 0, FL_MENU_TOGGLE | ( solo() ? FL_MENU_VALUE : 0 ) );
    _menu.add( "Move Up",        FL_SHIFT + '1', 0, 0 );
    _menu.add( "Move Down",        FL_SHIFT + '2', 0, 0 );
    _menu.add( "Remove",          0, 0, 0 ); // transport->rolling ? FL_MENU_INACTIVE : 0 );
  
    _menu.callback( &Track::menu_cb, (void*)this );

    return _menu;
}
开发者ID:shanipribadi,项目名称:non,代码行数:53,代码来源:Track.C

示例11: switch

int
Track::handle ( int m )
{

/*     if ( m != FL_NO_EVENT ) */
/*         DMESSAGE( "%s", event_name( m ) ); */
    static Fl_Widget *dragging = NULL;

    switch ( m )
    {
        case FL_DND_ENTER:
        case FL_DND_LEAVE:
        case FL_DND_DRAG:
        case FL_DND_RELEASE:
        case FL_PASTE:
            if ( Fl::event_x() > Track::width() )
                return sequence()->handle(m);
        default:
            break;
    }

    switch ( m )
    {
        case FL_KEYBOARD:
        {
            Fl_Menu_Button * men = &menu();

            if ( Fl::event_key() == FL_Menu )
            {
                menu_popup( men );
                return 1;
            }
            else
                return men->test_shortcut() || Fl_Group::handle( m );
        }
        case FL_MOUSEWHEEL:
        {
            Logger log( this );

            if ( ! Fl::event_shift() )
                return Fl_Group::handle( m );

            int d = Fl::event_dy();

            if ( d < 0 )
                size( size() - 1 );
            else
                size( size() + 1 );

            return 1;
        }
        case FL_PUSH:
        {
            if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->color_box ) )
            {
                dragging = this;
                return 1;
            }
            if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) )
                return 1;
            
            Logger log( this );

            if ( Fl_Group::handle( m ) )
                return 1;

            if ( test_press( FL_BUTTON3 ) && Fl::event_x() < Track::width() )
            {
                menu_popup( &menu() );
                return 1;
            }

            return 0;
        }
        /* we have to prevent Fl_Group::handle() from getting these, otherwise it will mess up Fl::belowmouse() */
        case FL_ENTER:
        case FL_LEAVE:
        case FL_MOVE:
            if ( Fl::event_x() >= Track::width() )
            {
                return Fl_Group::handle(m);
            }
            return 1;
        case FL_DND_ENTER:
            return 1;
        case FL_DND_LEAVE:
    
            if ( ! Fl::event_inside(this) && this == receptive_to_drop )
            {
                receptive_to_drop = 0;
                redraw();
                Fl::selection_owner(0);
            }
            return 1;
        case FL_RELEASE:
            if ( dragging == this )
            {
                dragging = NULL;
                timeline->insert_track( this, timeline->event_inside() );
                return 1;
//.........这里部分代码省略.........
开发者ID:shanipribadi,项目名称:non,代码行数:101,代码来源:Track.C

示例12: main


//.........这里部分代码省略.........
	substract += 5;
	}
	
	// Run browser
	if (doRunBrowser) {
		Fl_Group *g3 = new Fl_Group(0,0,100,20);
		g3->box(FL_FLAT_BOX);
		g3->layout_spacing(0);
		g3->layout_align(FL_ALIGN_LEFT);
		runBrowser = new Fl_Input_Browser("",100,FL_ALIGN_LEFT,30);
		//runBrowser->image(run_pix);
		runBrowser->box(FL_THIN_DOWN_BOX); // This is the only box type which works :(

		// Added _ALWAYS so callback is in case:
		// 1) select old command from input browser
		// 2) press enter to execute. (this won't work w/o _ALWAYS)
//		  runBrowser->input()->when(FL_WHEN_ENTER_KEY_ALWAYS | FL_WHEN_RELEASE_ALWAYS); 
		// Vedran: HOWEVER, with _ALWAYS cb_run_app will be called way
		// too many times, causing fork-attack
		runBrowser->input()->when(FL_WHEN_ENTER_KEY); 
		runBrowser->input()->callback((Fl_Callback*)cb_run_app);
		runBrowser->callback((Fl_Callback*)cb_run_app2);
		g3->end();
		g3->show();
		g3->resizable();

		v = new Fl_VertDivider(0, 0, 5, 18, "");
		v->layout_align(FL_ALIGN_LEFT);
	substract += 105;
	}


	// Popup menu for the whole taskbar
	Fl_Menu_Button *mPopupPanelProp = new Fl_Menu_Button( 0, 0, W, 28 );
	mPopupPanelProp->type( Fl_Menu_Button::POPUP3 );
	mPopupPanelProp->anim_flags(Fl_Menu_::LEFT_TO_RIGHT);
	mPopupPanelProp->anim_speed(0.8);
	mPopupPanelProp->begin();

	Fl_Item *mPanelSettings = new Fl_Item(_("Settings"));
	mPanelSettings->x_offset(12);
	mPanelSettings->callback( (Fl_Callback*)runUtility, (void*)"epanelconf" );
	new Fl_Divider(10, 5);

	Fl_Item *mAboutItem = new Fl_Item(_("About EDE..."));
	mAboutItem->x_offset(12);
	mAboutItem->callback( (Fl_Callback *)AboutDialog );

	mPopupPanelProp->end();

	// Taskbar...
	tasks = new TaskBar();

	// Dock and various entries...
	dock = new Dock();

	v = new Fl_VertDivider(0, 0, 5, 18, "");
	v->layout_align(FL_ALIGN_RIGHT);

	{
		// MODEM
		mModemLeds = new Fl_Group(0, 0, 25, 18);
		mModemLeds->box(FL_FLAT_BOX);
		mModemLeds->hide();
		mLedIn = new Fl_Box(2, 5, 10, 10);
		mLedIn->box( FL_OVAL_BOX );
开发者ID:edeproject,项目名称:svn,代码行数:67,代码来源:workpanel.cpp

示例13: Fl_Menu_Button

void gSampleChannel::__cb_openMenu()
{
	

	if (G_Mixer.chanInput == ch || recorder::active)
		return;

	

	Fl_Menu_Item rclick_menu[] = {
		{"Load new sample..."},                     
		{"Export sample to file..."},               
		{"Setup keyboard input..."},                
		{"Setup MIDI input..."},                    
		{"Setup MIDI output..."},                   
		{"Edit sample..."},                         
		{"Edit actions..."},                        
		{"Clear actions", 0, 0, 0, FL_SUBMENU},     
			{"All"},                                  
			{"Mute"},                                 
			{"Volume"},                               
			{"Start/Stop"},                           
			{0},                                      
			{"Clone channel"},                        
		{"Free channel"},                           
		{"Delete channel"},                         
		{0}
	};

	if (ch->status & (STATUS_EMPTY | STATUS_MISSING)) {
		rclick_menu[1].deactivate();
		rclick_menu[5].deactivate();
		rclick_menu[14].deactivate();
	}

	

	if (!ch->hasActions)
		rclick_menu[7].deactivate();

	

	if (ch->mode & LOOP_ANY)
		rclick_menu[11].deactivate();

	Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50);
	b->box(G_BOX);
	b->textsize(GUI_FONT_SIZE_BASE);
	b->textcolor(COLOR_TEXT_0);
	b->color(COLOR_BG_0);

	const Fl_Menu_Item *m = rclick_menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b);
	if (!m) return;

	if (strcmp(m->label(), "Load new sample...") == 0) {
		openBrowser(BROWSER_LOAD_SAMPLE);
		return;
	}

	if (strcmp(m->label(), "Setup keyboard input...") == 0) {
		new gdKeyGrabber(ch); 
		return;
	}

	if (strcmp(m->label(), "Setup MIDI input...") == 0) {
		gu_openSubWindow(mainWin, new gdMidiInputChannel(ch), 0);
		return;
	}

	if (strcmp(m->label(), "Setup MIDI output...") == 0) {
		gu_openSubWindow(mainWin, new gdMidiOutputSampleCh(ch), 0);
		return;
	}

	if (strcmp(m->label(), "Edit sample...") == 0) {
		gu_openSubWindow(mainWin, new gdEditor(ch), WID_SAMPLE_EDITOR); 
		return;
	}

	if (strcmp(m->label(), "Export sample to file...") == 0) {
		openBrowser(BROWSER_SAVE_SAMPLE);
		return;
	}

	if (strcmp(m->label(), "Delete channel") == 0) {
		if (!gdConfirmWin("Warning", "Delete channel: are you sure?"))
			return;
		glue_deleteChannel(ch);
		return;
	}

	if (strcmp(m->label(), "Free channel") == 0) {
		if (ch->status == STATUS_PLAY) {
			if (!gdConfirmWin("Warning", "This action will stop the channel: are you sure?"))
				return;
		}
		else if (!gdConfirmWin("Warning", "Free channel: are you sure?"))
			return;

		glue_freeChannel(ch);
//.........这里部分代码省略.........
开发者ID:tuffnerdstuff,项目名称:rockberry,代码行数:101,代码来源:ge_sampleChannel.cpp

示例14: Fl_Menu_Button

void gWaveform::openEditMenu() {

	if (selectionA == selectionB)
		return;

	menuOpen = true;

	Fl_Menu_Item menu[] = {
		{"Cut"},
		{"Trim"},
		{"Silence"},
		{"Fade in"},
		{"Fade out"},
		{"Smooth edges"},
		{"Set start/end here"},
		{0}
	};

	if (chan->status == STATUS_PLAY) {
		menu[0].deactivate();
		menu[1].deactivate();
	}

	Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50);
	b->box(G_BOX);
	b->textsize(11);
	b->textcolor(COLOR_TEXT_0);
	b->color(COLOR_BG_0);

	const Fl_Menu_Item *m = menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b);
	if (!m) {
		menuOpen = false;
		return;
	}

	/* straightSel() to ensure that point A is always lower than B */

	straightSel();

	if (strcmp(m->label(), "Silence") == 0) {
		wfx_silence(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB));

		selectionA = 0;
		selectionB = 0;

		stretchToWindow();
		redraw();
		menuOpen = false;
		return;
	}

	if (strcmp(m->label(), "Set start/end here") == 0) {

		glue_setBeginEndChannel(
				(gdEditor *) window(), // parent
				chan,
				absolutePoint(selectionA) * 2,  // stereo!
				absolutePoint(selectionB) * 2,  // stereo!
				false, // no recalc (we do it here)
				false  // don't check
				);

		selectionA     = 0;
		selectionB     = 0;
		selectionA_abs = 0;
		selectionB_abs = 0;

		recalcPoints();
		redraw();
		menuOpen = false;
		return;
	}

	if (strcmp(m->label(), "Cut") == 0) {
		wfx_cut(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB));

		/* for convenience reset start/end points */

		glue_setBeginEndChannel(
			(gdEditor *) window(),
			chan,
			0,
			chan->wave->size,
			false);

		selectionA     = 0;
		selectionB     = 0;
		selectionA_abs = 0;
		selectionB_abs = 0;

		setZoom(0);

		menuOpen = false;
		return;
	}

	if (strcmp(m->label(), "Trim") == 0) {
		wfx_trim(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB));

		glue_setBeginEndChannel(
//.........这里部分代码省略.........
开发者ID:micahscopes,项目名称:giada,代码行数:101,代码来源:ge_waveform.cpp

示例15: Fl_MDI_Window

Fl_Scopes_Manager::Fl_Scopes_Manager(int x, int y, int width, int height, Fl_MDI_Viewport *s, const char *name)
{
	Fl::lock();

	s->begin();
	Fl_MDI_Window *w = SWin = new Fl_MDI_Window(0, 0, width, height, name);
	w->user_data((void *)this);
	w->resizable(w->view());

	w->titlebar()->close_button()->hide();

	w->view()->begin();

	Scopes_Tabs = new Fl_Tabs*[Num_Scopes];
	Scope_Show = new Fl_Check_Button*[Num_Scopes];
	Scope_Pause = new Fl_Button*[Num_Scopes];
	Scope_OneShot = new Fl_Check_Button*[Num_Scopes];
	Scope_Options = new Fl_Menu_Button*[Num_Scopes];
	Grid_Color = new Fl_Button*[Num_Scopes];
	Bg_Color = new Fl_Button*[Num_Scopes];
	Sec_Div = new Fl_Input_Browser*[Num_Scopes];
	Save_Type = new Fl_Check_Button*[Num_Scopes];
	Save_Points = new Fl_Int_Input*[Num_Scopes];
	Save_Time = new Fl_Float_Input*[Num_Scopes];
	Save_File = new Fl_Input*[Num_Scopes];
	Save = new Fl_Light_Button*[Num_Scopes];
	Save_Flag = new int[Num_Scopes];
	Save_File_Pointer = new FILE*[Num_Scopes];

	Trace_Page = new Fl_Group**[Num_Scopes];
	Trace_Show = new Fl_Check_Button**[Num_Scopes];
	Units_Div = new Fl_Input_Browser**[Num_Scopes];
	Trace_Color = new Fl_Button**[Num_Scopes];
	Trace_Pos = new Fl_Dial**[Num_Scopes];
	Trace_Width = new Fl_Dial**[Num_Scopes];
 	Trigger_Mode = new Fl_Choice*[Num_Scopes];

        Trace_Options = new Fl_Menu_Button**[Num_Scopes];

	Scope_Windows = new Fl_Scope_Window*[Num_Scopes];

	for (int i = 0; i < Num_Scopes; i++) {
		Save_Flag[i] = false;
		{ Fl_Tabs *o = Scopes_Tabs[i] = new Fl_Tabs(160, 5, width-165, height-40);
		  o->new_page("General");
		  { Fl_Check_Button *o = Scope_Show[i] = new Fl_Check_Button(10, 25, 100, 20, "Show/Hide");
		    o->callback((Fl_Callback *)show_scope, (void *)i);
		  }
		  { Fl_Button *o = Scope_Pause[i] = new Fl_Button(10, 75, 90, 25, "Trigger");
		    o->value(0);
		    o->deactivate();
		    o->when(FL_WHEN_CHANGED);
		    o->callback((Fl_Callback *)pause_scope, (void *)i);
		  }
		  { Fl_Check_Button *o = Scope_OneShot[i] = new Fl_Check_Button(10, 50, 100, 20, "OneShot/Run");
		    o->deactivate();
		    o->callback((Fl_Callback *)oneshot_scope, (void *)i);
		  }
		  { Fl_Menu_Button *o = Scope_Options[i] = new Fl_Menu_Button(10, 105, 90, 25, "Options");
			o->menu(Scope_Opts);
			o->when(FL_WHEN_ENTER_KEY);
			o->child(0)->set_value();
		    	o->callback((Fl_Callback *)enter_options, (void *)i);
		  }
		  { Fl_Button *o = Grid_Color[i] = new Fl_Button(10, 135, 90, 25, "Grid Color");
		    o->callback((Fl_Callback *)select_grid_color, (void *)i);
		  }
		  { Fl_Button *o = Bg_Color[i] = new Fl_Button(10, 165, 90, 25, "Bg Color");
		    o->callback((Fl_Callback *)select_bg_color, (void *)i);
		  }
		  { Fl_Input_Browser *o = Sec_Div[i] = new Fl_Input_Browser(200, 25, 60, 20, "Sec/Div:  ");
		    o->add("0.001|0.005|0.01|0.05|0.1|0.5|1");
		    o->align(FL_ALIGN_LEFT);
		    o->value("0.1");
		    o->when(FL_WHEN_ENTER_KEY);
		    o->callback((Fl_Callback *)enter_secdiv, (void *)i);
		  }
		  { Fl_Check_Button *o = Save_Type[i] = new Fl_Check_Button(140, 50, 100, 20, "Points/Time");
		    o->value(1);
		    o->callback((Fl_Callback *)select_save, (void *)i);
		  }
		  { Fl_Int_Input *o = Save_Points[i] = new Fl_Int_Input(200, 75, 60, 20, "N Points: ");
		    o->align(FL_ALIGN_LEFT);
		    o->value("1000");
		  }
		  { Fl_Float_Input *o = Save_Time[i] = new Fl_Float_Input(200, 105, 60, 20, "Time [s]:  ");
		    o->align(FL_ALIGN_LEFT);
		    o->value("1.0");
		    o->deactivate();
		  }
		  { Fl_Input *o = Save_File[i] = new Fl_Input(200, 135, 100, 20, "Filename:");
		    char buf[100];
		    o->align(FL_ALIGN_LEFT);
		    sprintf(buf, "%s", Scopes[i].name);
		    o->value(buf);
		  }
		  { Fl_Light_Button *o = Save[i] = new Fl_Light_Button(140, 165, 90, 25, "Save");
		    o->selection_color(FL_BLACK);
		    o->callback((Fl_Callback *)enable_saving, (void *)i);
		  }
//.........这里部分代码省略.........
开发者ID:ArcEye,项目名称:RTAI,代码行数:101,代码来源:Fl_Scopes_Manager.cpp


注:本文中的Fl_Menu_Button类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。