コード例 #1
0
ファイル: gtkmenubutton.c プロジェクト: ahodesuka/gtk
static void
gtk_menu_button_clicked (GtkButton *button)
{
  GtkMenuButton *menu_button = GTK_MENU_BUTTON (button);
  GtkMenuButtonPrivate *priv = menu_button->priv;
  gboolean active = TRUE;

  if (priv->menu && !gtk_widget_get_visible (priv->menu))
    {
      GdkEvent *event;

      event = gtk_get_current_event ();

      popup_menu (menu_button,
                  (event && event->type != GDK_BUTTON_RELEASE) ?
                  (GdkEventButton *) event : NULL);

      if (!event ||
          event->type == GDK_KEY_PRESS ||
          event->type == GDK_KEY_RELEASE)
        gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE);

      if (event)
        gdk_event_free (event);
    }
  else if (priv->popover && !gtk_widget_get_visible (priv->popover))
    gtk_widget_show (priv->popover);
  else
    active = FALSE;

  GTK_BUTTON_CLASS (gtk_menu_button_parent_class)->clicked (button);

  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
  gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (button));
}
コード例 #2
0
ファイル: gtkspell.c プロジェクト: FabrizioFabbe/silc
/* ok, this is pretty wacky:
 * we need to let the right-mouse-click go through, so it moves the cursor, 
 * but we *can't* let it go through, because GtkText interprets rightclicks as
 * weird selection modifiers.
 *
 * so what do we do?  forge rightclicks as leftclicks, then popup the menu. 
 * HACK HACK HACK. 
 */
static gint button_press_intercept_cb(GtkText *gtktext, GdkEvent *e, gpointer d) {
	GdkEventButton *eb;
	gboolean retval;

	if (!gtkspell_running()) return FALSE;

	if (e->type != GDK_BUTTON_PRESS) return FALSE;
	eb = (GdkEventButton*) e;

	if (eb->button != 3) return FALSE;

	/* forge the leftclick */
	eb->button = 1;

	gtk_signal_handler_block_by_func(GTK_OBJECT(gtktext), 
			GTK_SIGNAL_FUNC(button_press_intercept_cb), d);
	gtk_signal_emit_by_name(GTK_OBJECT(gtktext), "button-press-event",
			e, &retval);
	gtk_signal_handler_unblock_by_func(GTK_OBJECT(gtktext), 
			GTK_SIGNAL_FUNC(button_press_intercept_cb), d);
	gtk_signal_emit_stop_by_name(GTK_OBJECT(gtktext), "button-press-event");

	/* now do the menu wackiness */
	popup_menu(gtktext, eb);
	return TRUE;
}
コード例 #3
0
ファイル: world_tree.c プロジェクト: LADI/ladish
gboolean on_button_pressed(GtkWidget * treeview, GdkEventButton * event, gpointer UNUSED(userdata))
{
  /* single click with the right mouse button? */
  if (event->type == GDK_BUTTON_PRESS && event->button == 3)
  {
    /* select row if no row is selected or only one other row is selected */
    {
      GtkTreeSelection *selection;

      selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));

      /* Note: gtk_tree_selection_count_selected_rows() does not exist in gtk+-2.0, only in gtk+ >= v2.2 ! */
      if (gtk_tree_selection_count_selected_rows(selection) <= 1)
      {
        GtkTreePath *path;

        /* Get tree path for row that was clicked */
        if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), (gint)event->x, (gint)event->y, &path, NULL, NULL, NULL))
        {
          gtk_tree_selection_unselect_all(selection);
          gtk_tree_selection_select_path(selection, path);
          gtk_tree_path_free(path);
        }
      }
    }

    popup_menu(treeview, event);

    return TRUE; /* we handled this */
  }

  return FALSE; /* we did not handle this */
}
コード例 #4
0
ファイル: lists.c プロジェクト: proton/xmpc
static gboolean
cb_button_pressed (XfmpcLists *lists,
									GdkEventButton *event)
{
	XfmpcListsPrivate    *priv = XFMPC_LISTS (lists)->priv;
	GtkTreeSelection         *selection;
	GtkTreePath              *path;

	if (event->type != GDK_BUTTON_PRESS || event->button != 3)
		return FALSE;

	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
	if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->treeview),
																		event->x, event->y,
																		&path, NULL, NULL, NULL))
		{
			if (!gtk_tree_selection_path_is_selected (selection, path))
				{
					gtk_tree_selection_unselect_all (selection);
					gtk_tree_selection_select_path (selection, path);
				}
			gtk_tree_path_free (path);
		}

	popup_menu (lists);

	return TRUE;
}
コード例 #5
0
ファイル: gtk_mod.c プロジェクト: AlexMarlo/baresip
static gboolean status_icon_on_button_press(GtkStatusIcon *status_icon,
		GdkEventButton *event,
		struct gtk_mod *mod)
{
	popup_menu(mod, gtk_status_icon_position_menu, status_icon,
			event->button, event->time);
	return TRUE;
}
コード例 #6
0
void DraggableListView::MouseDown(BPoint point) {
	uint32 buttons = Looper()->CurrentMessage()->FindInt32("buttons");
	int32 index = IndexOf(point);
	if (buttons & B_SECONDARY_MOUSE_BUTTON && index >= 0) {
		Select(index);
		if (list_type == filter) {
			BPopUpMenu popup_menu("popup_menu", false, false);
			popup_menu.SetFont(be_plain_font);
			BMessage* del_msg = new BMessage(SM_REMOVE_FILTER);
			del_msg->AddInt32("filter_id", ((FilterItem*)ItemAt(index))->FilterID());
			BMessage* help_msg = new BMessage(SM_HELP_REQUESTED);
			help_msg->AddString("addon_name", ((FilterItem*)ItemAt(index))->Text());
			popup_menu.AddItem(new BMenuItem("Delete", del_msg));
			popup_menu.AddItem(new BMenuItem("Add-on Help"B_UTF8_ELLIPSIS, help_msg));
			BMenuItem* item = popup_menu.Go(ConvertToScreen(point));
			if (item != NULL) {
				if (strcmp(item->Label(),"Delete") == 0) {
					be_app_messenger.SendMessage(item->Message());
					delete RemoveItem(index);
				if (strcmp(item->Label(),"Add-on Help"B_UTF8_ELLIPSIS) == 0)
					Window()->PostMessage(item->Message());
				}
			}
		} else {
			BView* active_list = Window()->FindView("active_list");
			if (active_list != NULL) {
				BPopUpMenu popup_menu("popup_menu", false, false);
				popup_menu.SetFont(be_plain_font);
				BMessage* add_msg = new BMessage(SM_DRAG_FILTER);
				add_msg->AddString("filter_name", ((BStringItem*)ItemAt(index))->Text());
				BMessage* help_msg = new BMessage(SM_HELP_REQUESTED);
				help_msg->AddString("addon_name", ((BStringItem*)ItemAt(index))->Text());
				popup_menu.AddItem(new BMenuItem("Add", add_msg));
				popup_menu.AddItem(new BMenuItem("Add-on Help"B_UTF8_ELLIPSIS, help_msg));
				BMenuItem* item = popup_menu.Go(ConvertToScreen(point));
				if (item != NULL) {
					if (strcmp(item->Label(),"Add") == 0)
						active_list->MessageReceived(item->Message());
					if (strcmp(item->Label(),"Add-on Help"B_UTF8_ELLIPSIS) == 0)
						Window()->PostMessage(item->Message());
				}
			}
		}
	}
	BListView::MouseDown(point);
}
コード例 #7
0
ファイル: perfnames.cpp プロジェクト: 0rel/sequencer64
bool
perfnames::on_button_release_event (GdkEventButton * p0)
{
    if (SEQ64_CLICK_RIGHT(p0->button))
        popup_menu();

    return false;
}
コード例 #8
0
ファイル: item.cpp プロジェクト: edeproject/svn
int EItemGroup::handle(int event)
{
    if(event == FL_RELEASE) {
        if( fltk::event_button() == 3) {
            ::dir = this->dir();
            int ret = popup_menu();
            ::dir = 0;
            if(ret) return 0;
        }
        return 1;
    }
    return fltk::Item_Group::handle(event);
}
コード例 #9
0
ファイル: item.cpp プロジェクト: edeproject/svn
int EItem::handle(int event)
{
    if(event==FL_RELEASE) {
        if(type()==FILE) {
            if(fltk::event_button() == 3) {
                ::dir = this->dir();
                int ret = popup_menu();
                ::dir = 0;
                return 1;
            }
            if(((EItemGroup*)parent())->group_type()==BROWSER_GROUP) return 1;
        }
    }
    return fltk::Item::handle(event);
}
コード例 #10
0
ファイル: mu-msg-body-view.c プロジェクト: antono/mu
static gboolean
on_button_press_event (MuMsgBodyView *self, GdkEventButton *event, gpointer data)
{
    /* ignore all but the first (typically, left) mouse button */
	switch (event->button) {
	case 1: return FALSE; /* propagate, let widget handle it */
	case 3:
		/* no popup menus for notes */
		if (self->_priv->_view_mode != VIEW_MODE_NOTE)
			popup_menu (self, event->button, event->time);
		break;
	default: return TRUE; /* ignore */
	}
	
	return (event->button > 1) ? TRUE : FALSE;	
}
コード例 #11
0
ファイル: textview.c プロジェクト: jmzaleski/ivtools-1.2
void TE_View::press(const Event& e)
{
    if (active_) {
   // translate event coordinates for window into coordinates for
   // the editor.
   int index = event_to_index(e);

   switch(e.pointer_button()) {
   case Event::left:
      drag_mode_ = DragSelect;
      text_editor_->Select(index);
      break;
   case Event::middle:
      drag_mode_ = DragSelect;
      break;
   case Event::right:
      popup_menu(e);
      drag_mode_ = DragMenu;
      break;
   }
}
}
コード例 #12
0
ファイル: Item.cpp プロジェクト: LADI/ladish
void
Item::on_click(GdkEventButton* event)
{
	boost::shared_ptr<Canvas> canvas = _canvas.lock();
	if (!canvas)
		return;

	if (event->button == 1) {
		if (_selected) {
			canvas->unselect_item(shared_from_this());
			assert(!_selected);
		} else {
			if ( !(event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)))
				canvas->clear_selection();
			canvas->select_item(shared_from_this());
		}
	}

	if (event->button == 3 && popup_menu(event->button, event->time))
		return;

	signal_clicked.emit(event);
}
コード例 #13
0
ファイル: mousing.c プロジェクト: curiousbadger/denemo
/**
 * Mouse button press callback
 *
 */
gint
scorearea_button_press (GtkWidget * widget, GdkEventButton * event)
{
  DenemoProject *gui = Denemo.project;
  if (gui == NULL || gui->movement == NULL)
    return FALSE;
  gboolean left = (event->button != 3);
  //if the cursor is at a system separator start dragging it
  gint allocated_height = get_widget_height (Denemo.scorearea);
  gint line_height = allocated_height * gui->movement->system_height;
  gint line_num = ((int) event->y) / line_height;
  last_event_x = event->x_root;
  last_event_y = event->y_root;
  //g_debug("diff %d\n", line_height - ((int)event->y)%line_height);

  if (dragging_separator == FALSE)
    if (line_height - ((int) event->y - 8) % line_height < 12)
      {
        if (Denemo.prefs.learning)
          MouseGestureShow(_("Dragging line separator."), _("This will allow the display to show more music, split into lines. The typeset score is not affected."),
            MouseGesture);
        dragging_separator = TRUE;
        return TRUE;
      }
  dragging_separator = FALSE;

  if(gui->movement->recording)
    {
     //g_debug("audio %f %f\n", event->x, event->y);


      if(event->y < 20*gui->movement->zoom /* see draw.c for this value, the note onsets are drawn in the top 20 pixels */)
        {
            if (event->type==GDK_2BUTTON_PRESS)
                {
                    gui->movement->marked_onset_position = (gint)event->x/gui->movement->zoom;
                    if(gui->movement->marked_onset_position < (gui->leftmargin+35) + SPACE_FOR_TIME + gui->movement->maxkeywidth) {
                         if (Denemo.prefs.learning)
                            MouseGestureShow(_("Double Click Note Onset"), _("This represents detected note onsets which occur\nbefore the start of the score.\nIf they are just noise,\nor if you are working on just a portion of the audio that is ok.\nOtherwise drag with left mouse button to synchronize\nwith the start of the score."),
          MouseGesture);

                    }
                    gtk_widget_queue_draw(Denemo.scorearea);
                    return TRUE;
                } else
                {
                    gdk_window_set_cursor (gtk_widget_get_window (Denemo.window), gdk_cursor_new (left?GDK_SB_H_DOUBLE_ARROW:GDK_X_CURSOR));
                    left? (dragging_audio = TRUE) : (dragging_tempo = TRUE);
                     if (Denemo.prefs.learning)
                     left? MouseGestureShow(_("Left Drag Note Onset"), _("This moves the audio to synchronize the start with the score.\nYou can use the Leadin button for this too."),
          MouseGesture) :
                        MouseGestureShow(_("Right Drag Note Onset"), _("This changes the tempo of the score.\nUse this to synchronize the beat after setting the start"),
          MouseGesture);
                    gtk_widget_queue_draw(Denemo.scorearea);
                    return TRUE;
                }
        }

    }


  //g_debug("before %f %f\n", event->x, event->y);
  transform_coords (&event->x, &event->y);
  //g_debug("after %f %f\n", event->x, event->y);


  gtk_widget_grab_focus (widget);
  gint key = gui->movement->maxkeywidth;
  gint cmajor = key ? 0 : 5;    //allow some area for keysig in C-major

  if (gui->lefts[line_num] == 0)
    return TRUE;                //On an empty system at the bottom where there is not enough room to draw another staff.

  struct placement_info pi;
  pi.the_staff = NULL;
  if (event->y < 0)
    get_placement_from_coordinates (&pi, event->x, 0, gui->lefts[line_num], gui->rights[line_num], gui->scales[line_num]);
  else
    get_placement_from_coordinates (&pi, event->x, event->y, gui->lefts[line_num], gui->rights[line_num], gui->scales[line_num]);
  if (pi.the_staff == NULL)
    return TRUE;                //could not place the cursor
  change_staff (gui->movement, pi.staff_number, pi.the_staff);


  if (left && (gui->movement->leftmeasurenum > 1) && (event->x < (gui->leftmargin+35) + SPACE_FOR_TIME + key) && (event->x > gui->leftmargin))
    {
      if (Denemo.prefs.learning)
        MouseGestureShow(_("Press Left."), _("This moved the cursor to the measure offscreen left. The display is shifted to place that measure on screen."),
          MouseGesture);
      set_currentmeasurenum (gui, gui->movement->leftmeasurenum - 1);
      write_status (gui);
      draw_score_area();
      return TRUE;
    }
  else if (pi.nextmeasure)
    {
      if ((pi.at_edge) && ((pi.the_obj==NULL) || ((pi.the_obj->next == NULL) && (pi.offend))))//crashed here with the_obj 0x131 !!!
        {
          if ((gui->movement->currentmeasurenum != gui->movement->rightmeasurenum) &&
                (!set_currentmeasurenum (gui, gui->movement->rightmeasurenum + 1)))
              set_currentmeasurenum (gui, gui->movement->rightmeasurenum);
          else if ((gui->movement->cursor_appending) &&
                (!set_currentmeasurenum (gui, gui->movement->rightmeasurenum + 1)))
              set_currentmeasurenum (gui, gui->movement->rightmeasurenum);




          if (gui->movement->currentmeasurenum != gui->movement->rightmeasurenum) {
            if (Denemo.prefs.learning)
              MouseGestureShow(_("Press Left."), _("This moved the cursor to the measure off-screen right. The display is shifted to move the cursor to the middle."),
                MouseGesture);
          write_status (gui);
          return TRUE;
        }
        }
    }


  if (pi.the_measure != NULL)
    {                           /*don't place cursor in a place that is not there */
      //gui->movement->currentstaffnum = pi.staff_number;
      //gui->movement->currentstaff = pi.the_staff;
      gui->movement->currentmeasurenum = pi.measure_number;
      gui->movement->currentmeasure = pi.the_measure;
      gui->movement->currentobject = pi.the_obj;
      gui->movement->cursor_x = pi.cursor_x;
      gui->movement->cursor_appending = (gui->movement->cursor_x == (gint) (g_list_length ((objnode *) ((DenemoMeasure*)gui->movement->currentmeasure->data)->objects)));
      set_cursor_y_from_click (gui, event->y);
      if (event->type==GDK_2BUTTON_PRESS)
                {
                    if(gui->movement->recording &&  !g_strcmp0 (((DenemoStaff *) gui->movement->currentstaff->data)->denemo_name->str, DENEMO_CLICK_TRACK_NAME))
                        {
                            gui->movement->marked_onset_position = (gint)event->x/gui->movement->zoom;
                            if (Denemo.prefs.learning)
                                MouseGestureShow(_("Double Click on Click Track"), _("This will mark the MIDI note onset."), MouseGesture);
                            return TRUE;

                        }

                    else
                        {
                          if (Denemo.prefs.learning)
                            MouseGestureShow(_("Double Click."), _("This gives information about the object at the cursor. Click on a notehead for information about a note in a chord."),
                              MouseGesture);
                                    display_current_object();
                                    return TRUE;
                        }
                }
            else
                {
                  if (Denemo.prefs.learning)
                    MouseGestureShow(_("Press Left."), _("This moved the cursor to the object position clicked. The cursor height becomes the clicked point."),
                      MouseGesture);
                            write_status (gui);
               }
            }

  gint offset = (gint) get_click_height (gui, event->y);

   if ((((DenemoStaff *) gui->movement->currentstaff->data)->voicecontrol != DENEMO_PRIMARY)
        && (gui->movement->leftmeasurenum == 1) && (event->x > gui->leftmargin)
        && ((event->x < (gui->leftmargin+35) + SPACE_FOR_TIME + key)))
    {
          infodialog(_("The clef shown here affects the display only (as this voice is displayed on the staff above)."
          " You can change the display clef using the clef menu."
          "\nWarning! you will get confused if you set the key signature or time signature of a voice different "
          "to the staff it is typeset on. Run the Staff/Voice property editor to adjust any inconsistencies."));

    }
  if ((((DenemoStaff *) gui->movement->currentstaff->data)->voicecontrol == DENEMO_PRIMARY) && (gui->movement->leftmeasurenum == 1) && (event->x > gui->leftmargin))
    {
      if (event->x < (gui->leftmargin+35) - cmajor)
        {
        if (offset<-10)
            {
                if (Denemo.prefs.learning)
                MouseGestureShow(_("Left on Staff name."), _("This pops up the built-in staff properties. For other properties of the current staff see the staff menu or the tools icon before the clef."),
                  MouseGesture);
                staff_properties_change_cb (NULL, NULL);
            }
        else
            {
              if (Denemo.prefs.learning)
                MouseGestureShow(_("Left on initial Clef."), _("This pops up the initial clef menu."),
                  MouseGesture);
              popup_menu ("/InitialClefEditPopup");
            }
          return TRUE;
        }
      else if (event->x < (gui->leftmargin+35) + key + cmajor)
        {
          if (left)
            {
              if (offset > 0 && (offset < STAFF_HEIGHT / 2))
                {
                  if (Denemo.prefs.learning)
                    MouseGestureShow(_("Left Click on blue."), _("This adds one sharp."),
                      MouseGesture);
                if ((gui->movement->currentmeasure->next==NULL)  || confirm (_("Initial Key Signature Change"), _("Sharpen Keysignature?")))
                  call_out_to_guile ("(d-SharpenInitialKeysigs)");
                }
              else if (offset > 0 && (offset < STAFF_HEIGHT))
                {
                  if (Denemo.prefs.learning)
                    MouseGestureShow(_("Left Click on red."), _("This adds one flat."),
                      MouseGesture);
                  if ((gui->movement->currentmeasure->next==NULL) || confirm (_("Initial Key Signature Change"), _("Flatten Keysignature?")))
                    call_out_to_guile ("(d-FlattenInitialKeysigs)");
                }
            }
          else
            {
              if (Denemo.prefs.learning)
                MouseGestureShow(_("Right Click on key."), _("This pops up the key signature menu."),
                    MouseGesture);
              popup_menu ("/InitialKeyEditPopup");
            }
          return TRUE;
        }
      else if (event->x < (gui->leftmargin+35) + SPACE_FOR_TIME + key)
        {
          if (Denemo.prefs.learning)
            MouseGestureShow(_("Click on Time."), _("This pops up the time signature menu."),
                    MouseGesture);
          popup_menu ("/InitialTimeEditPopup");
          return TRUE;
        }
    }

  if (event->x < gui->leftmargin)
    {
       if (gui->braces)
        {
                gint width = BRACEWIDTH * g_list_length (gui->braces);
                //gint count = (gui->leftmargin - event->x)/BRACEWIDTH;
                if ((gui->leftmargin - event->x) < width)
                {
                    gint count = 1 + (width - gui->leftmargin + event->x)/BRACEWIDTH;


                    if ((count>0) && (count <= g_list_length (gui->braces)))
                        {
                            DenemoBrace *brace = (DenemoBrace*)g_list_nth_data (gui->braces, count-1);
                            gint choice = choose_option (_("Editing Staff Groups (Braces)"), _("Edit Start Brace"), _("Edit End Brace"));
                            gint staffnum = choice?brace->startstaff:brace->endstaff;
                            //g_print ("Count is %d for start at %d\n", count, staffnum);
                            GtkWidget *menuitem = gtk_ui_manager_get_widget (Denemo.ui_manager, "/ObjectMenu/StaffMenu/StaffGroupings");
                            goto_movement_staff_obj (NULL, -1, staffnum, 1, 0, 0);
                            if (menuitem)
                                if (choice)
                                    gtk_menu_popup (GTK_MENU (gtk_menu_item_get_submenu (GTK_MENU_ITEM (menuitem))), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
                                else
                                {
                                    if (staff_directive_get_tag ("BraceEnd"))
                                        call_out_to_guile ("(d-BraceEnd)");
                                    else
                                        warningdialog (_( "This staff grouping has no End Brace so it finishes on the lowest staff. Use the Staffs/Voices->Staff Groupings menu to place an End Brace on the desired staff"));
                                }
                            //note the popup returns as soon as the menu is popped up, so we can't go back to the original position.

                        }

                    return TRUE;
                }

        }

      if (pi.staff_number == gui->movement->currentstaffnum)
        {
          gint offset = (gint) get_click_height (gui, event->y);
          if (offset < STAFF_HEIGHT / 2)
            {
              if (((DenemoStaff *) gui->movement->currentstaff->data)->staff_directives, 1)
                {
                  if (Denemo.prefs.learning)
                    MouseGestureShow(_("Click on Staff Directives."), _("This pops up the staff directives menu for editing"),
                      MouseGesture);
                  edit_staff_properties ();//gtk_menu_popup (((DenemoStaff *) gui->movement->currentstaff->data)->staffmenu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
                }
              return TRUE;
            }
          else if (((DenemoStaff *) gui->movement->currentstaff->data)->voice_directives, 1)
            {
              if (Denemo.prefs.learning)
                MouseGestureShow(_("Click on Voice Directives."), _("This pops up the voice directives menu for editing"),
                    MouseGesture);
              edit_voice_properties ();//gtk_menu_popup (((DenemoStaff *) gui->movement->currentstaff->data)->voicemenu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
              return TRUE;
            }
        }
    }

  if (left)
    {
      if (!(GDK_SHIFT_MASK & event->state))
        gui->movement->markstaffnum = 0;
      lh_down = TRUE;
    }
  else
    {
      if (gui->movement->cursor_appending && (event->state==0))
        {
          if (Denemo.prefs.learning)
           {

                    MouseGestureShow(_("Right Click Appending."), _("This pops up the append menu"),
                        MouseGesture);

           }
          popup_menu ("/NoteAppendPopup");
          return TRUE;
        }

        if ((GDK_CONTROL_MASK & event->state) == GDK_CONTROL_MASK) {
            if (Denemo.prefs.learning)
                    MouseGestureShow(_("Control-Right Click."), _("This pops up menu for inserting barlines and many other sorts of objects"),
                        MouseGesture);
            gtk_menu_popup (GTK_MENU (gtk_widget_get_parent(gtk_ui_manager_get_widget (Denemo.ui_manager, "/ObjectMenu/Directives/Markings"))),
                            NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
            return TRUE;
        }
      if ((GDK_SHIFT_MASK & event->state) == GDK_SHIFT_MASK) {
            if (Denemo.prefs.learning)
                    MouseGestureShow(_("Shift-Right Click."), _("This allows editing the directives/attributes of the object at the cursor"),
                        MouseGesture);
            call_out_to_guile ("(d-EditSimilar 'once)");
            return TRUE;
        }
    }



  if (left && (GDK_SHIFT_MASK & event->state) && (GDK_CONTROL_MASK & event->state))
  {
     // if current object is directive, start dragging its graphic, dragging_display=TRUE

      DenemoObject *obj;
      if (Denemo.prefs.learning)
                    MouseGestureShow(_("Control-Shift-Drag."), _("This allows dragging objects in the display.\nAll sorts of directives such as staccato dots, ornaments, repeat marks etc can be dragged if the display is too cluttered.\nThe typeset score is unaffected.\nClick on a notehead to drag things attached to the notehead,\nor off the noteheads for things attached to the whole chord."),
                        MouseGesture);

    last_directive = get_next_directive_at_cursor ();
    if(last_directive)
        {
            score_status (Denemo.project, TRUE);
            return TRUE;
        }
    infodialog (_("Control-Shift-Drag is used to tidy up the Denemo display. Useful if Denemo has created a clutter with your input music.\nIf you have several things attached to one object you can move them in turn by dragging them in turn.\nNotes, Slurs and Ties are fixed but most other things can be moved to make the input music clear. Does not affect the typeset score!\nNB! if you have dragged something to one side of a note you have to control-shift-click on the note itself to drag it back - it is where the cursor is that counts."));
    return TRUE;
 }






  set_cursor_for (event->state | (left ? GDK_BUTTON1_MASK : GDK_BUTTON3_MASK));




  //displayhelper(Denemo.project);
  draw_score(NULL);//this is needed to refresh cached values such as the prevailing time signature, before the command is invoked

  perform_command (event->state | (left ? GDK_BUTTON1_MASK : GDK_BUTTON3_MASK), GESTURE_PRESS, left);

  return TRUE;
}
コード例 #14
0
ファイル: gtk_mod.c プロジェクト: AlexMarlo/baresip
static void mqueue_handler(int id, void *data, void *arg)
{
	struct gtk_mod *mod = arg;
	const char *uri;
	struct call *call;
	int err;
	struct ua *ua = uag_current();
	(void)mod;

	switch ((enum gtk_mod_events)id) {

	case MQ_POPUP:
		gdk_threads_enter();
		popup_menu(mod, NULL, NULL, 0, GPOINTER_TO_UINT(data));
		gdk_threads_leave();
		break;

	case MQ_CONNECT:
		uri = data;
		err = ua_connect(ua, &call, NULL, uri, NULL, VIDMODE_ON);
		if (err) {
			gdk_threads_enter();
			warning_dialog("Call failed",
					"Connecting to \"%s\" failed.\n"
					"Error: %m", uri, err);
			gdk_threads_leave();
			break;
		}
		gdk_threads_enter();
		err = new_call_window(mod, call) == NULL;
		gdk_threads_leave();
		if (err) {
			ua_hangup(ua, call, 500, "Server Error");
		}
		break;

	case MQ_HANGUP:
		call = data;
		ua_hangup(ua, call, 0, NULL);
		break;

	case MQ_QUIT:
		ua_stop_all(false);
		break;

	case MQ_ANSWER:
		call = data;
		err = ua_answer(ua, call);
		if (err) {
			gdk_threads_enter();
			warning_dialog("Call failed",
					"Answering the call "
					"from \"%s\" failed.\n"
					"Error: %m",
					call_peername(call), err);
			gdk_threads_leave();
			break;
		}

		gdk_threads_enter();
		err = new_call_window(mod, call) == NULL;
		gdk_threads_leave();
		if (err) {
			ua_hangup(ua, call, 500, "Server Error");
		}
		break;

	case MQ_SELECT_UA:
		ua = data;
		uag_current_set(ua);
		break;
	}
}
コード例 #15
0
ファイル: lists.c プロジェクト: proton/xmpc
static gboolean
cb_popup_menu (XfmpcLists *lists)
{
	popup_menu (lists);
	return TRUE;
}
コード例 #16
0
ファイル: tilda_terminal.c プロジェクト: JaewookYim/tilda
static int button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer data)
{
    DEBUG_FUNCTION ("button_press_cb");
    DEBUG_ASSERT (data != NULL);

    VteTerminal *terminal;
    tilda_term *tt;
    gchar *match;
    gint tag;
    gint xpad, ypad;
    gchar *cmd;
    gchar *web_browser_cmd;
    gboolean ret = FALSE;

    tt = TILDA_TERM(data);

    switch (event->button)
    {
        case 3: /* Right Click */
            popup_menu (tt->tw, tt);
            break;
        case 2: /* Middle Click */
            break;
        case 1: /* Left Click */
            terminal  = VTE_TERMINAL(tt->vte_term);
            GtkBorder border;
            gtk_widget_style_get (GTK_WIDGET (terminal),
                "inner-border", &border, NULL);
            xpad = border.left;
            ypad = border.bottom;
            match = vte_terminal_match_check (terminal,
                    (event->x - ypad) /
                    vte_terminal_get_char_width (terminal),
                    (event->y - ypad) /
                    vte_terminal_get_char_height (terminal),
                    &tag);

            /* Check if we can launch a web browser, and do so if possible */
            if ((event->state & GDK_CONTROL_MASK) && match != NULL)
            {
#if DEBUG
                g_print ("Got a Ctrl+Left Click -- Matched: `%s' (%d)\n", match, tag);
#endif
                web_browser_cmd = g_strescape (config_getstr ("web_browser"), NULL);
                cmd = g_strdup_printf ("%s %s", web_browser_cmd, match);
#if DEBUG
                g_print ("Launching command: `%s'\n", cmd);
#endif
                ret = g_spawn_command_line_async(cmd, NULL);

                /* Check that the command launched */
                if (!ret)
                {
                    g_printerr (_("Failed to launch the web browser. The command was `%s'\n"), cmd);
                    TILDA_PERROR ();
                }

                g_free (cmd);
            }

            /* Always free match if it is non NULL */
            if (match)
                g_free (match);

            break;
        default:
            break;
    }

    return FALSE;
}
コード例 #17
0
ファイル: FED.C プロジェクト: MegaGod/TW
void file_menu( void ) {
	static saved = 1;
	char *buff, ans[2] = "y";
	static char *menu[] = {
		"Main Menu",
		" 1.load screen font",
		" 2.load italic screen font",
		" 3.load 9 pins font",
		" 4.load italic 9 pins font",
		" 5.load 24 pins font",
		" 6.load italic 24 pins font",
		" 7.load super&subscript font",
		" 8.load italic superscript",
		" 9.load .FED file",
		"10.save font file",
		"11.continue working",
		"12.exit",
		0 };
	while ( 1 ) {
		switch ( popup_menu( menu, &buff ) ) {
		case 0:
			new_load = SCR_FONT;
			break;
		case 1:
			new_load = ITALIC_SCR_FONT;
			break;
		case 2:
			new_load = PRN_FONT;
			break;
		case 3:
			new_load = ITALIC_PRN_FONT;
			break;
		case 4:
			new_load = LQ_FONT;
			break;
		case 5:
			new_load = ITALIC_LQ_FONT;
			break;
		case 6:
			new_load = SUP_SUB_LQ_FONT;
			break;
		case 7:
			new_load = ITALIC_SUP_SUB_LQ_FONT;
			break;
		case 8:
			new_load = FED_FONT;
			break;
		case 9:
			if ( loaded ) {
				if ( save_font( ) ) {
					saved = !0;
				}
			} else {
				error_message( "You haven't load font yet!" );
			}
			remove_menu( &buff );
			continue;
		case 10:
			if ( first_file ) {
				error_message( "You haven't load font yet!" );
				remove_menu( &buff );
				continue;
			}
			remove_menu( &buff );
			new_load = 0;
			first_file = 0;
			return;
		case 11:
			if ( !saved ) {
				switch ( immediatebox( 40, 10, NOTSAVEPROMPT, ans ) ) {
				case 1:
					if ( save_font( ) ) {
						terminate( );
						exit( 0 );
					} else {
						remove_menu( &buff );
						continue;
					}
				case 0:
					terminate( );
					exit( 0 );
				case -1:
					remove_menu( &buff );
					return;
				}
			} else {
				terminate( );
				exit( 0 );
			}
		}

		if ( new_load ) {
			if ( !saved ) {
				switch ( immediatebox( 40, 10, NOTSAVEPROMPT, ans ) ) {
				case 1:
					if ( save_font( ) ) {
						saved = !0;
					} else {
						remove_menu( &buff );
						new_load = 0;
						continue;
					}
					break;
				case 0:
					break;
				case -1:remove_menu( &buff );
					new_load = 0;
					continue;
				}
			}

			if ( load_font( ) ) {
				clearworkarea( );
				print_table( 0 );
				loaded = new_load;
				new_load = 0;
				first_file = 0;
				saved = 0;
				free( buff );
				return;
			} else {
				remove_menu( &buff );
				continue;
			}
		}
	}
}
コード例 #18
0
ファイル: world_tree.c プロジェクト: LADI/ladish
gboolean on_popup_menu(GtkWidget * treeview, gpointer UNUSED(userdata))
{
  popup_menu(treeview, NULL);
  return TRUE; /* we handled this */
}