• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ gtk_widget_queue_draw函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: gtk_radio_menu_item_activate

static void
gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
{
  GtkRadioMenuItem *radio_menu_item;
  GtkCheckMenuItem *check_menu_item;
  GtkCheckMenuItem *tmp_menu_item;
  GSList *tmp_list;
  gint toggled;

  g_return_if_fail (GTK_IS_RADIO_MENU_ITEM (menu_item));

  radio_menu_item = GTK_RADIO_MENU_ITEM (menu_item);
  check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
  toggled = FALSE;

  if (check_menu_item->active)
    {
      tmp_menu_item = NULL;
      tmp_list = radio_menu_item->group;

      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
	    break;

	  tmp_menu_item = NULL;
	}

      if (tmp_menu_item)
	{
	  toggled = TRUE;
	  check_menu_item->active = !check_menu_item->active;
	}
    }
  else
    {
      toggled = TRUE;
      check_menu_item->active = !check_menu_item->active;

      tmp_list = radio_menu_item->group;
      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
	    {
	      gtk_menu_item_activate (GTK_MENU_ITEM (tmp_menu_item));
	      break;
	    }
	}
    }

  if (toggled)
    gtk_check_menu_item_toggled (check_menu_item);

  gtk_widget_queue_draw (GTK_WIDGET (radio_menu_item));
}
开发者ID:batman52,项目名称:dingux-code,代码行数:61,代码来源:gtkradiomenuitem.c


示例2: undo_redo

/**
 * undo_redo:
 * @w: not used
 * @data: not used
 *
 * executes a redo request on the current document
 **/
void undo_redo(UndoMain *undostruct)
{
    UndoInfo *redoinfo;
    GtkTextView *textview;
    GtkTextBuffer *buffer;
    GtkTextIter iter, start_iter, end_iter;
    GtkTextMark *mark;

    g_return_if_fail(undostruct != NULL);

    if (undostruct->redo == NULL) return;

    redoinfo = (UndoInfo *)undostruct->redo->data;
    g_return_if_fail (redoinfo != NULL);
    undostruct->undo = g_list_prepend(undostruct->undo, redoinfo);
    undostruct->redo = g_list_remove(undostruct->redo, redoinfo);

    textview = undostruct->textview;
    buffer = gtk_text_view_get_buffer(textview);

    undo_block(undostruct);

    /* Check if there is a selection active */
    mark = gtk_text_buffer_get_insert(buffer);
    gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
    gtk_text_buffer_place_cursor(buffer, &iter);

    /* Move the view to the right position. */
    gtk_adjustment_set_value(textview->vadjustment,
                             redoinfo->window_position);

    switch (redoinfo->action) {
    case UNDO_ACTION_INSERT:
        gtk_text_buffer_get_iter_at_offset
        (buffer, &iter, redoinfo->start_pos);
        gtk_text_buffer_insert(buffer, &iter, redoinfo->text, -1);
        debug_print("redo: UNDO_ACTION_DELETE: %d: %s\n",
                    redoinfo->start_pos, redoinfo->text);
        break;
    case UNDO_ACTION_DELETE:
        gtk_text_buffer_get_iter_at_offset
        (buffer, &start_iter, redoinfo->start_pos);
        gtk_text_buffer_get_iter_at_offset
        (buffer, &end_iter, redoinfo->end_pos);
        gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
        debug_print("redo: UNDO_ACTION_INSERT: %d: delete %d chars\n",
                    redoinfo->start_pos,
                    redoinfo->end_pos - redoinfo->start_pos);
        break;
    case UNDO_ACTION_REPLACE_DELETE:
        gtk_text_buffer_get_iter_at_offset
        (buffer, &start_iter, redoinfo->start_pos);
        gtk_text_buffer_get_iter_at_offset
        (buffer, &end_iter, redoinfo->end_pos);
        gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
        debug_print("redo: UNDO_ACTION_REPLACE: %d: %s\n",
                    redoinfo->start_pos, redoinfo->text);
        /* "pull" another data structure from the list */
        redoinfo = (UndoInfo *)undostruct->redo->data;
        g_return_if_fail(redoinfo != NULL);
        undostruct->undo = g_list_prepend(undostruct->undo, redoinfo);
        undostruct->redo = g_list_remove(undostruct->redo, redoinfo);
        g_return_if_fail(redoinfo->action == UNDO_ACTION_REPLACE_INSERT);
        gtk_text_buffer_insert(buffer, &start_iter, redoinfo->text, -1);
        debug_print("redo: UNDO_ACTION_REPLACE: %d: %s\n",
                    redoinfo->start_pos, redoinfo->text);
        break;
    case UNDO_ACTION_REPLACE_INSERT:
        g_warning("redo: this should not happen: UNDO_REPLACE_INSERT");
        break;
    default:
        g_assert_not_reached();
        break;
    }

    gtk_widget_queue_draw(GTK_WIDGET(textview));

    undostruct->change_state_func(undostruct,
                                  UNDO_STATE_TRUE, UNDO_STATE_UNCHANGED,
                                  undostruct->change_state_data);

    if (undostruct->redo == NULL)
        undostruct->change_state_func(undostruct,
                                      UNDO_STATE_UNCHANGED,
                                      UNDO_STATE_FALSE,
                                      undostruct->change_state_data);

    undo_unblock(undostruct);
}
开发者ID:ChakaZulu,项目名称:sylpheed_upstream,代码行数:96,代码来源:undo.c


示例3: dt_control_key_pressed

int dt_control_key_pressed(guint key, guint state)
{
  int handled = dt_view_manager_key_pressed(darktable.view_manager, key, state);
  if(handled) gtk_widget_queue_draw(dt_ui_center(darktable.gui->ui));
  return handled;
}
开发者ID:cmagina,项目名称:darktable,代码行数:6,代码来源:control.c


示例4: gui_update

void gui_update(struct dt_iop_module_t *self)
{
  // nothing to do, gui curve is read directly from params during expose event.
  gtk_widget_queue_draw(self->widget);
}
开发者ID:gapato,项目名称:darktable,代码行数:5,代码来源:levels.c


示例5: _lib_modulelist_gui_update

static void _lib_modulelist_gui_update(struct dt_lib_module_t *module)
{
    gtk_widget_queue_draw(GTK_WIDGET(((dt_lib_modulelist_t *)module->data)->tree));
}
开发者ID:bluesceada,项目名称:darktable,代码行数:4,代码来源:modulelist.c


示例6: _gtk_widget_queue_draw

static gboolean _gtk_widget_queue_draw(gpointer user_data)
{
  gtk_widget_queue_draw(GTK_WIDGET(user_data));
  return FALSE;
}
开发者ID:CoreyChen922,项目名称:darktable,代码行数:5,代码来源:control.c


示例7: gimp_tag_popup_list_event

static gboolean
gimp_tag_popup_list_event (GtkWidget    *widget,
                           GdkEvent     *event,
                           GimpTagPopup *popup)
{
  if (event->type == GDK_BUTTON_PRESS)
    {
      GdkEventButton *button_event = (GdkEventButton *) event;
      gint            x;
      gint            y;
      gint            i;

      popup->single_select_disabled = TRUE;

      x = button_event->x;
      y = button_event->y + popup->scroll_y;

      for (i = 0; i < popup->tag_count; i++)
        {
          PopupTagData *tag_data = &popup->tag_data[i];

          if (gimp_tag_popup_is_in_tag (tag_data, x, y))
            {
              gimp_tag_popup_toggle_tag (popup, tag_data);
              gtk_widget_queue_draw (widget);
              break;
            }
        }
    }
  else if (event->type == GDK_MOTION_NOTIFY)
    {
      GdkEventMotion *motion_event = (GdkEventMotion *) event;
      PopupTagData   *prelight     = NULL;
      gint            x;
      gint            y;
      gint            i;

      x = motion_event->x;
      y = motion_event->y + popup->scroll_y;

      for (i = 0; i < popup->tag_count; i++)
        {
          PopupTagData *tag_data = &popup->tag_data[i];

          if (gimp_tag_popup_is_in_tag (tag_data, x, y))
            {
              prelight = tag_data;
              break;
            }
        }

      if (prelight != popup->prelight)
        {
          if (popup->prelight)
            gimp_tag_popup_queue_draw_tag (popup, popup->prelight);

          popup->prelight = prelight;

          if (popup->prelight)
            gimp_tag_popup_queue_draw_tag (popup, popup->prelight);
        }
    }
  else if (event->type == GDK_BUTTON_RELEASE &&
           ! popup->single_select_disabled)
    {
      GdkEventButton *button_event = (GdkEventButton *) event;
      gint            x;
      gint            y;
      gint            i;

      popup->single_select_disabled = TRUE;

      x = button_event->x;
      y = button_event->y + popup->scroll_y;

      for (i = 0; i < popup->tag_count; i++)
        {
          PopupTagData *tag_data = &popup->tag_data[i];

          if (gimp_tag_popup_is_in_tag (tag_data, x, y))
            {
              gimp_tag_popup_toggle_tag (popup, tag_data);
              gtk_widget_destroy (GTK_WIDGET (popup));
              break;
            }
        }
    }

  return FALSE;
}
开发者ID:Amerekanets,项目名称:gimp-1,代码行数:90,代码来源:gimptagpopup.c


示例8: histo_update_time_window_hook

gint histo_update_time_window_hook(void *hook_data, void *call_data)
{
  HistoControlFlowData *histocontrol_flow_data = (HistoControlFlowData*) hook_data;
  histoDrawing_t *drawing = histocontrol_flow_data->drawing;
  
  const TimeWindowNotifyData *histo_time_window_nofify_data = 
                          ((const TimeWindowNotifyData *)call_data);

  TimeWindow *histo_old_time_window = 
    histo_time_window_nofify_data->old_time_window;
  TimeWindow *histo_new_time_window = 
    histo_time_window_nofify_data->new_time_window;
  
  // Update the ruler 
  histo_drawing_update_ruler(drawing,
                       histo_new_time_window);

  /* Two cases : zoom in/out or scrolling */
  
  /* In order to make sure we can reuse the old drawing, the scale must
   * be the same and the new time interval being partly located in the
   * currently shown time interval. (reuse is only for scrolling)
   */

  g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
      histo_old_time_window->start_time.tv_sec,
      histo_old_time_window->start_time.tv_nsec,
      histo_old_time_window->time_width.tv_sec,
      histo_old_time_window->time_width.tv_nsec);

  g_info("New time window HOOK : %lu, %lu to %lu, %lu",
      histo_new_time_window->start_time.tv_sec,
      histo_new_time_window->start_time.tv_nsec,
      histo_new_time_window->time_width.tv_sec,
      histo_new_time_window->time_width.tv_nsec);

 //For Histo,redraw always except if zoom fit is pushed 2 times consequently
 if( histo_new_time_window->start_time.tv_sec == histo_old_time_window->start_time.tv_sec
  && histo_new_time_window->start_time.tv_nsec == histo_old_time_window->start_time.tv_nsec
  && histo_new_time_window->time_width.tv_sec == histo_old_time_window->time_width.tv_sec
  && histo_new_time_window->time_width.tv_nsec == histo_old_time_window->time_width.tv_nsec)
  {
	return 0;  
  }   
  histo_rectangle_pixmap (drawing->drawing_area->style->black_gc,
          TRUE,
          0, 0,
          drawing->width,//+SAFETY, // do not overlap
          -1,drawing);

    drawing->damage_begin = 0;
    drawing->damage_end = drawing->width;

    gtk_widget_queue_draw(drawing->drawing_area);
    histo_request_event(histocontrol_flow_data,drawing->damage_begin,
			drawing->damage_end- drawing->damage_begin);
  
  gdk_window_process_updates(drawing->drawing_area->window,TRUE);

//show number of event at current time 

  histo_drawing_update_vertical_ruler(drawing);
  return 0;
}
开发者ID:adannis,项目名称:lttv,代码行数:64,代码来源:histoeventhooks.c


示例9: histo_update_current_time_hook

gint histo_update_current_time_hook(void *hook_data, void *call_data)
{
  HistoControlFlowData *histocontrol_flow_data = (HistoControlFlowData*)hook_data;
  histoDrawing_t *drawing = histocontrol_flow_data->drawing;

  LttTime current_time = *((LttTime*)call_data);
  
  TimeWindow time_window =
            lttvwindow_get_time_window(histocontrol_flow_data->tab);
  
  LttTime time_begin = time_window.start_time;
  LttTime width = time_window.time_width;
  LttTime half_width;
  {
    guint64 time_ll = ltt_time_to_uint64(width);
    time_ll = time_ll >> 1; /* divide by two */
    half_width = ltt_time_from_uint64(time_ll);
  }
  LttTime time_end = ltt_time_add(time_begin, width);

  LttvTraceset *traceset =
        lttvwindow_get_traceset(histocontrol_flow_data->tab);
  TimeInterval time_span = lttv_traceset_get_time_span_real(traceset);

  LttTime trace_start = time_span.start_time;
  LttTime trace_end = time_span.end_time;
  
  g_info("Histogram: New current time HOOK : %lu, %lu", current_time.tv_sec,
              current_time.tv_nsec);


  
  /* If current time is inside time interval, just move the highlight
   * bar */

  /* Else, we have to change the time interval. We have to tell it
   * to the main window. */
  /* The time interval change will take care of placing the current
   * time at the center of the visible area, or nearest possible if we are
   * at one end of the trace. */
  
  
  if(ltt_time_compare(current_time, time_begin) < 0)
  {
    TimeWindow histo_new_time_window;

    if(ltt_time_compare(current_time,
          ltt_time_add(trace_start,half_width)) < 0)
      time_begin = trace_start;
    else
      time_begin = ltt_time_sub(current_time,half_width);
  
    histo_new_time_window.start_time = time_begin;
    histo_new_time_window.time_width = width;
    histo_new_time_window.time_width_double = ltt_time_to_double(width);
    histo_new_time_window.end_time = ltt_time_add(time_begin, width);

    lttvwindow_report_time_window(histocontrol_flow_data->tab, histo_new_time_window);
  }
  else if(ltt_time_compare(current_time, time_end) > 0)
  {
    TimeWindow histo_new_time_window;

    if(ltt_time_compare(current_time, ltt_time_sub(trace_end, half_width)) > 0)
      time_begin = ltt_time_sub(trace_end,width);
    else
      time_begin = ltt_time_sub(current_time,half_width);
  
    histo_new_time_window.start_time = time_begin;
    histo_new_time_window.time_width = width;
    histo_new_time_window.time_width_double = ltt_time_to_double(width);
    histo_new_time_window.end_time = ltt_time_add(time_begin, width);

    lttvwindow_report_time_window(histocontrol_flow_data->tab, histo_new_time_window);
    
  }
  gtk_widget_queue_draw(drawing->drawing_area);
  
  /* Update directly when scrolling */
  gdk_window_process_updates(drawing->drawing_area->window,
      TRUE);

  histo_drawing_update_vertical_ruler(drawing);
                         
  return 0;
}
开发者ID:adannis,项目名称:lttv,代码行数:86,代码来源:histoeventhooks.c


示例10: _lib_filmstrip_dnd_begin_callback

static void
_lib_filmstrip_dnd_begin_callback(GtkWidget *widget, GdkDragContext *context, gpointer user_data)
{
  const int ts = 64;

  dt_lib_module_t *self = (dt_lib_module_t *)user_data;
  dt_lib_filmstrip_t *strip = (dt_lib_filmstrip_t *)self->data;

  int imgid = strip->mouse_over_id;

  // imgid part of selection -> do nothing
  // otherwise               -> select the current image
  strip->select = DT_LIB_FILMSTRIP_SELECT_NONE;
  sqlite3_stmt *stmt;
  DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from selected_images where imgid=?1", -1, &stmt, NULL);
  DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
  if(sqlite3_step(stmt) != SQLITE_ROW)
  {
    dt_selection_select_single(darktable.selection, imgid);
    /* redraw filmstrip */
    if(darktable.view_manager->proxy.filmstrip.module)
      gtk_widget_queue_draw(darktable.view_manager->proxy.filmstrip.module->widget);
  }
  sqlite3_finalize(stmt);

  // if we are dragging a single image -> use the thumbnail of that image
  // otherwise use the generic d&d icon
  // TODO: have something pretty in the 2nd case, too.
  if(dt_collection_get_selected_count(NULL) == 1)
  {
    dt_mipmap_buffer_t buf;
    dt_mipmap_size_t mip = dt_mipmap_cache_get_matching_size(darktable.mipmap_cache, ts, ts);
    dt_mipmap_cache_read_get(darktable.mipmap_cache, &buf, imgid, mip, DT_MIPMAP_BLOCKING);

    if(buf.buf)
    {
      uint8_t *scratchmem = dt_mipmap_cache_alloc_scratchmem(darktable.mipmap_cache);
      uint8_t *buf_decompressed = dt_mipmap_cache_decompress(&buf, scratchmem);

      uint8_t *rgbbuf = g_malloc((buf.width+2)*(buf.height+2)*3);
      memset(rgbbuf, 64, (buf.width+2)*(buf.height+2)*3);
      for(int i=1; i<=buf.height; i++)
        for(int j=1; j<=buf.width; j++)
          for(int k=0; k<3; k++)
            rgbbuf[(i*(buf.width+2)+j)*3+k] = buf_decompressed[((i-1)*buf.width+j-1)*4+2-k];

      int w=ts, h=ts;
      if(buf.width < buf.height) w = (buf.width*ts)/buf.height; // portrait
      else                       h = (buf.height*ts)/buf.width; // landscape

      GdkPixbuf *source = gdk_pixbuf_new_from_data(rgbbuf, GDK_COLORSPACE_RGB, FALSE, 8, (buf.width+2), (buf.height+2), (buf.width+2)*3, NULL, NULL);
      GdkPixbuf *scaled = gdk_pixbuf_scale_simple(source, w, h, GDK_INTERP_HYPER);
      gtk_drag_set_icon_pixbuf(context, scaled, 0, 0);

      if(source)
        g_object_unref(source);
      if(scaled)
        g_object_unref(scaled);
      free(scratchmem);
      g_free(rgbbuf);
    }

    dt_mipmap_cache_read_release(darktable.mipmap_cache, &buf);
  }
}
开发者ID:danielbaak,项目名称:darktable,代码行数:65,代码来源:filmstrip.c


示例11: _lib_filmstrip_button_press_callback

static gboolean _lib_filmstrip_button_press_callback(GtkWidget *w, GdkEventButton *e, gpointer user_data)
{
  dt_lib_module_t *self = (dt_lib_module_t *)user_data;
  dt_lib_filmstrip_t *strip = (dt_lib_filmstrip_t *)self->data;

  int32_t mouse_over_id = strip->mouse_over_id;
  strip->select = DT_LIB_FILMSTRIP_SELECT_NONE;

  if (e->button == 1)
  {
    if(e->type == GDK_BUTTON_PRESS)
    {
      /* let check if any thumb controls was clicked */
      switch(strip->image_over)
      {
        case DT_VIEW_DESERT:
          /* is this an activation of image */
          if ((e->state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) == 0)
            strip->select = DT_LIB_FILMSTRIP_SELECT_SINGLE;
          else if ((e->state & (GDK_CONTROL_MASK)) == GDK_CONTROL_MASK)
            strip->select = DT_LIB_FILMSTRIP_SELECT_TOGGLE;
          else if ((e->state & (GDK_SHIFT_MASK)) == GDK_SHIFT_MASK)
            strip->select = DT_LIB_FILMSTRIP_SELECT_RANGE;
          if(strip->select != DT_LIB_FILMSTRIP_SELECT_NONE)
          {
            strip->select_id = mouse_over_id;
            return TRUE;
          }
          break;
        case DT_VIEW_REJECT:
        case DT_VIEW_STAR_1:
        case DT_VIEW_STAR_2:
        case DT_VIEW_STAR_3:
        case DT_VIEW_STAR_4:
        case DT_VIEW_STAR_5:
        {
          int offset = 0;
          if(mouse_over_id == strip->activated_image)
            offset = dt_collection_image_offset(mouse_over_id);

          const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, mouse_over_id);
          dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
          if(strip->image_over == DT_VIEW_STAR_1 && ((image->flags & 0x7) == 1)) image->flags &= ~0x7;
          else if(strip->image_over == DT_VIEW_REJECT && ((image->flags & 0x7) == 6)) image->flags &= ~0x7;
          else
          {
            image->flags &= ~0x7;
            image->flags |= strip->image_over;
          }
          dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
          dt_image_cache_read_release(darktable.image_cache, image);


          dt_collection_hint_message(darktable.collection); // More than this, we need to redraw all

          if(mouse_over_id == strip->activated_image)
            if(_lib_filmstrip_imgid_in_collection(darktable.collection, mouse_over_id) == 0)
              dt_view_filmstrip_scroll_relative(0, offset);

          gtk_widget_queue_draw(darktable.view_manager->proxy.filmstrip.module->widget);
          return TRUE;
        }

        default:
          return FALSE;
      }
    }
    else if(e->type == GDK_2BUTTON_PRESS)
    {
      if (mouse_over_id > 0)
      {
        strip->activated_image = mouse_over_id;
        dt_control_signal_raise(darktable.signals, DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE);
        return TRUE;
      }
    }
  }

  return FALSE;
}
开发者ID:danielbaak,项目名称:darktable,代码行数:80,代码来源:filmstrip.c


示例12: timeout

/* Timeout handler to regenerate the frame */
static gint
timeout (gpointer data)
{
  double f;
  int i;
  double xmid, ymid;
  double radius;

  gdk_pixbuf_copy_area (background, 0, 0, back_width, back_height,
                        frame, 0, 0);

  f = (double) (frame_num % CYCLE_LEN) / CYCLE_LEN;

  xmid = back_width / 2.0;
  ymid = back_height / 2.0;

  radius = MIN (xmid, ymid) / 2.0;

  for (i = 0; i < N_IMAGES; i++)
    {
      double ang;
      int xpos, ypos;
      int iw, ih;
      double r;
      GdkRectangle r1, r2, dest;
      double k;

      ang = 2.0 * G_PI * (double) i / N_IMAGES - f * 2.0 * G_PI;

      iw = gdk_pixbuf_get_width (images[i]);
      ih = gdk_pixbuf_get_height (images[i]);

      r = radius + (radius / 3.0) * sin (f * 2.0 * G_PI);

      xpos = floor (xmid + r * cos (ang) - iw / 2.0 + 0.5);
      ypos = floor (ymid + r * sin (ang) - ih / 2.0 + 0.5);

      k = (i & 1) ? sin (f * 2.0 * G_PI) : cos (f * 2.0 * G_PI);
      k = 2.0 * k * k;
      k = MAX (0.25, k);

      r1.x = xpos;
      r1.y = ypos;
      r1.width = iw * k;
      r1.height = ih * k;

      r2.x = 0;
      r2.y = 0;
      r2.width = back_width;
      r2.height = back_height;

      if (gdk_rectangle_intersect (&r1, &r2, &dest))
        gdk_pixbuf_composite (images[i],
                              frame,
                              dest.x, dest.y,
                              dest.width, dest.height,
                              xpos, ypos,
                              k, k,
                              GDK_INTERP_NEAREST,
                              ((i & 1)
                               ? MAX (127, fabs (255 * sin (f * 2.0 * G_PI)))
                               : MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
    }

  GDK_THREADS_ENTER ();
  gtk_widget_queue_draw (da);
  GDK_THREADS_LEAVE ();

  frame_num++;
  return TRUE;
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:72,代码来源:pixbufs.c


示例13: on_tick

/* Handler to regenerate the frame */
static gboolean
on_tick (GtkWidget     *widget,
         GdkFrameClock *frame_clock,
         gpointer       data)
{
  gint64 current_time;
  double f;
  int i;
  double xmid, ymid;
  double radius;

  gdk_pixbuf_copy_area (background, 0, 0, back_width, back_height,
                        frame, 0, 0);

  if (start_time == 0)
    start_time = gdk_frame_clock_get_frame_time (frame_clock);

  current_time = gdk_frame_clock_get_frame_time (frame_clock);
  f = ((current_time - start_time) % CYCLE_TIME) / (double)CYCLE_TIME;

  xmid = back_width / 2.0;
  ymid = back_height / 2.0;

  radius = MIN (xmid, ymid) / 2.0;

  for (i = 0; i < N_IMAGES; i++)
    {
      double ang;
      int xpos, ypos;
      int iw, ih;
      double r;
      GdkRectangle r1, r2, dest;
      double k;

      ang = 2.0 * G_PI * (double) i / N_IMAGES - f * 2.0 * G_PI;

      iw = gdk_pixbuf_get_width (images[i]);
      ih = gdk_pixbuf_get_height (images[i]);

      r = radius + (radius / 3.0) * sin (f * 2.0 * G_PI);

      xpos = floor (xmid + r * cos (ang) - iw / 2.0 + 0.5);
      ypos = floor (ymid + r * sin (ang) - ih / 2.0 + 0.5);

      k = (i & 1) ? sin (f * 2.0 * G_PI) : cos (f * 2.0 * G_PI);
      k = 2.0 * k * k;
      k = MAX (0.25, k);

      r1.x = xpos;
      r1.y = ypos;
      r1.width = iw * k;
      r1.height = ih * k;

      r2.x = 0;
      r2.y = 0;
      r2.width = back_width;
      r2.height = back_height;

      if (gdk_rectangle_intersect (&r1, &r2, &dest))
        gdk_pixbuf_composite (images[i],
                              frame,
                              dest.x, dest.y,
                              dest.width, dest.height,
                              xpos, ypos,
                              k, k,
                              GDK_INTERP_NEAREST,
                              ((i & 1)
                               ? MAX (127, fabs (255 * sin (f * 2.0 * G_PI)))
                               : MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
    }

  gtk_widget_queue_draw (da);

  return G_SOURCE_CONTINUE;
}
开发者ID:3dfxmadscientist,项目名称:gnome-apps,代码行数:76,代码来源:pixbufs.c


示例14: live_preview_cb


//.........这里部分代码省略.........
                            width  != ud->preview->render_width ||
                            height != ud->preview->render_height)
                        {
                            double xscale, yscale;

                            xscale = (double)ud->preview->render_width /
                                             ud->preview->width;
                            yscale = (double)ud->preview->render_height /
                                             ud->preview->height;
                            if (xscale <= yscale)
                            {
                                width  = ud->preview->render_width;
                                height = ud->preview->height * xscale;
                            }
                            else
                            {
                                width  = ud->preview->width * yscale;
                                height = ud->preview->render_height;
                            }

                            ud->preview->scaled_pix =
                                gdk_pixbuf_scale_simple(pix,
                                                        width, height,
                                                        GDK_INTERP_BILINEAR);
                            g_object_ref(pix);
                        }
                        else
                        {
                            ud->preview->scaled_pix = pix;
                        }
                        ud->preview->pix = ud->preview->scaled_pix;
                        g_object_ref(ud->preview->pix);
                        widget = GHB_WIDGET (ud->builder, "preview_image");
                        gtk_widget_queue_draw(widget);
                    }
                }
            }
        } break;

        case GST_MESSAGE_SEGMENT_START:
        {
            //printf("segment start\n");
        } break;

        case GST_MESSAGE_SEGMENT_DONE:
        {
            //printf("segment done\n");
        } break;

        case GST_MESSAGE_DURATION_CHANGED:
        {
            //printf("duration change\n");
        };

        case GST_MESSAGE_LATENCY:
        {
            //printf("latency\n");
        };

        case GST_MESSAGE_ASYNC_START:
        {
            //printf("async start\n");
        } break;

        case GST_MESSAGE_ASYNC_DONE:
        {
开发者ID:RandomEngy,项目名称:HandBrake,代码行数:67,代码来源:preview.c


示例15: on_motion_notify_desklet

static gboolean on_motion_notify_desklet (GtkWidget *pWidget,
	GdkEventMotion* pMotion,
	CairoDesklet *pDesklet)
{
	/*if (pMotion->state & GDK_BUTTON1_MASK && cairo_dock_desklet_is_free (pDesklet))
	{
		cd_debug ("root : %d;%d", (int) pMotion->x_root, (int) pMotion->y_root);
	}
	else*/  // le 'press-button' est local au sous-widget clique, alors que le 'motion-notify' est global a la fenetre; c'est donc par lui qu'on peut avoir a coup sur les coordonnees du curseur (juste avant le clic).
	{
		pDesklet->container.iMouseX = pMotion->x;
		pDesklet->container.iMouseY = pMotion->y;
		gboolean bStartAnimation = FALSE;
		gldi_object_notify (pDesklet, NOTIFICATION_MOUSE_MOVED, pDesklet, &bStartAnimation);
		if (bStartAnimation)
			cairo_dock_launch_animation (CAIRO_CONTAINER (pDesklet));
	}
	
	if (pDesklet->rotating && cairo_dock_desklet_is_free (pDesklet))
	{
		double alpha = atan2 (pDesklet->container.iHeight, - pDesklet->container.iWidth);
		pDesklet->fRotation = alpha - atan2 (.5*pDesklet->container.iHeight - pMotion->y, pMotion->x - .5*pDesklet->container.iWidth);
		while (pDesklet->fRotation > G_PI)
			pDesklet->fRotation -= 2 * G_PI;
		while (pDesklet->fRotation <= - G_PI)
			pDesklet->fRotation += 2 * G_PI;
		gtk_widget_queue_draw(pDesklet->container.pWidget);
	}
	else if (pDesklet->rotatingY && cairo_dock_desklet_is_free (pDesklet))
	{
		pDesklet->fDepthRotationY = G_PI * (pMotion->x - .5*pDesklet->container.iWidth) / pDesklet->container.iWidth;
		gtk_widget_queue_draw(pDesklet->container.pWidget);
	}
	else if (pDesklet->rotatingX && cairo_dock_desklet_is_free (pDesklet))
	{
		pDesklet->fDepthRotationX = G_PI * (pMotion->y - .5*pDesklet->container.iHeight) / pDesklet->container.iHeight;
		gtk_widget_queue_draw(pDesklet->container.pWidget);
	}
	else if (pMotion->state & GDK_BUTTON1_MASK && cairo_dock_desklet_is_free (pDesklet) && ! pDesklet->moving)
	{
		gtk_window_begin_move_drag (GTK_WINDOW (gtk_widget_get_toplevel (pWidget)),
			1/*pButton->button*/,
			pMotion->x_root/*pButton->x_root*/,
			pMotion->y_root/*pButton->y_root*/,
			pDesklet->time/*pButton->time*/);
		pDesklet->moving = TRUE;
	}
	else
	{
		gboolean bStartAnimation = FALSE;
		Icon *pIcon = gldi_desklet_find_clicked_icon (pDesklet);
		if (pIcon != NULL)
		{
			if (! pIcon->bPointed)
			{
				Icon *pPointedIcon = cairo_dock_get_pointed_icon (pDesklet->icons);
				if (pPointedIcon != NULL)
					pPointedIcon->bPointed = FALSE;
				pIcon->bPointed = TRUE;
				
				//g_print ("on survole %s\n", pIcon->cName);
				gldi_object_notify (pDesklet, NOTIFICATION_ENTER_ICON, pIcon, pDesklet, &bStartAnimation);
			}
		}
		else
		{
			Icon *pPointedIcon = cairo_dock_get_pointed_icon (pDesklet->icons);
			if (pPointedIcon != NULL)
			{
				pPointedIcon->bPointed = FALSE;
				
				//g_print ("kedal\n");
				//gldi_object_notify (pDesklet, NOTIFICATION_ENTER_ICON, pPointedIcon, pDesklet, &bStartAnimation);
			}
		}
		if (bStartAnimation)
		{
			cairo_dock_launch_animation (CAIRO_CONTAINER (pDesklet));
		}
	}
	
	gdk_device_get_state (pMotion->device, pMotion->window, NULL, NULL);  // pour recevoir d'autres MotionNotify.
	return FALSE;
}
开发者ID:363734,项目名称:cairo-dock-core,代码行数:84,代码来源:cairo-dock-desklet-factory.c


示例16: button_press_event

static gboolean
button_press_event (GtkWidget *widget, GdkEventButton *event)
{
    widget_data_t *data = get_widget_data(widget);

    data->mouse_down = map_location(data, _point(event->x, event->y));

    designer_node_t *hn = NULL;
    _hit_t ht = HIT_NOTHING;
    int hs = -1;

    /* check for best node hit */
    for (GSList *list = data->design->nodes;
	list != NULL; list = list->next) {
	designer_node_t *node = list->data;

	_hit_t nht = hit_node(node, data->mouse_down);
	if (nht) {
	    hn = node;
	    ht = nht;
	}
    }

    if (event->type == GDK_2BUTTON_PRESS)
	return double_click_event(widget, event, hn, ht);

    switch(ht) {
    case HIT_LABEL:
    case HIT_TITLE:
    case HIT_BODY:
	data->active_node = hn;
	data->state = STATE_MOVING;
	data->origin = node_data(hn)->origin;
	designer_node_push_back(hn);
	break;
    case HIT_CLOSE:
	designer_disconnect_and_delete_node(hn);
	promote_focus(data);
	signal_design_change(data);
	update_area_conditional(data, FALSE);
	break;
    case HIT_INPUT:
	hs = hit_input_slot(hn, data->mouse_down);

	/* loosen connection if connected */
	if (data->target_check == DESIGNER_CONNECTION_CONNECTABLE) {
	    loosen_connection(data, hn, hs);
	    data->state = STATE_CONOUT;
	    break;
	}
	data->active_node = hn;
	data->active_slot_id = hs;
	data->origin = input_slot_origin(hn, hs);
	// g_print("hit %lf,%lf -> %d\n", event->x, event->y, data->active_slot_id);
	data->state = STATE_CONIN;
	break;
    case HIT_OUTPUT:
	hs = hit_output_slot(hn, data->mouse_down);
	data->active_node = hn;
	data->active_slot_id = hs;
	data->origin = output_slot_origin(hn, data->active_slot_id);
	// g_print("hit %lf,%lf -> %d\n", event->x, event->y, data->active_slot_Id);
	data->state = STATE_CONOUT;
	break;
    default:
	data->state = STATE_IDLE;
	break;
    }

    data->dragging = TRUE;

    gtk_widget_queue_draw(widget);
    return TRUE;
}
开发者ID:WoodMath,项目名称:mathmap,代码行数:74,代码来源:cairo_widget.c


示例17: gtk_switch_button_release

static gboolean
gtk_switch_button_release (GtkWidget      *widget,
                           GdkEventButton *event)
{
  GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
  GtkAllocation allocation;

  /* Don't handle extra mouse buttons events, let them bubble up */
  if (event->button > 5)
    return GDK_EVENT_PROPAGATE;

  gtk_widget_get_allocation (widget, &allocation);

  /* dragged toggles have a "soft" grab, so we don't care whether we
   * are in the switch or not when the button is released; we do care
   * for direct toggles, instead
   */
  if (!priv->is_dragging && !priv->in_switch)
    return GDK_EVENT_PROPAGATE;

  /* direct toggle */
  if (priv->in_press)
    {
      priv->in_press = FALSE;
      gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);

      return GDK_EVENT_STOP;
    }

  /* toggle the switch if the handle was clicked but a drag had not been
   * initiated */
  if (!priv->is_dragging && !priv->in_press)
    {
      gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);

      return GDK_EVENT_STOP;
    }

  /* dragged toggle */
  if (priv->is_dragging)
    {
      priv->is_dragging = FALSE;

      /* if half the handle passed the middle of the switch, then we
       * consider it to be on
       */
      if ((priv->handle_x + (allocation.width / 4)) >= (allocation.width / 2))
        {
          gtk_switch_set_active (GTK_SWITCH (widget), TRUE);
          priv->handle_x = allocation.width / 2;
        }
      else
        {
          gtk_switch_set_active (GTK_SWITCH (widget), FALSE);
          priv->handle_x = 0;
        }

      gtk_widget_queue_draw (widget);

      return GDK_EVENT_STOP;
    }

  return GDK_EVENT_PROPAGATE;
}
开发者ID:3dfxmadscientist,项目名称:gtk,代码行数:64,代码来源:gtkswitch.c


示例18: photos_print_preview_set_property

static void
photos_print_preview_set_property (GObject      *object,
				guint         prop_id,
				const GValue *value,
				GParamSpec   *pspec)
{
	PhotosPrintPreviewPrivate *priv = PHOTOS_PRINT_PREVIEW (object)->priv;
	gboolean paper_size_changed = FALSE;

	switch (prop_id) {
	case PROP_PIXBUF:
		if (priv->pixbuf) {
			g_object_unref (priv->pixbuf);
		}
		priv->pixbuf = GDK_PIXBUF (g_value_dup_object (value));

		if (priv->pixbuf_scaled) {
			g_object_unref (priv->pixbuf_scaled);
			priv->pixbuf_scaled = NULL;
		}

		priv->flag_create_surface = TRUE;
		break;
	case PROP_PIXBUF_X_ALIGN:
		priv->pixbuf_x_align = g_value_get_float (value);
		break;
	case PROP_PIXBUF_Y_ALIGN:
		priv->pixbuf_y_align = g_value_get_float (value);
		break;
	case PROP_PIXBUF_SCALE:
		priv->i_scale = g_value_get_float (value);
		priv->flag_create_surface = TRUE;
		break;
	case PROP_PAPER_WIDTH:
		priv->p_width = g_value_get_float (value);
		paper_size_changed = TRUE;
		break;
	case PROP_PAPER_HEIGHT:
		priv->p_height = g_value_get_float (value);
		paper_size_changed = TRUE;
		break;
	case PROP_PAGE_LEFT_MARGIN:
		priv->l_margin = g_value_get_float (value);
		break;
	case PROP_PAGE_RIGHT_MARGIN:
		priv->r_margin = g_value_get_float (value);
		break;
	case PROP_PAGE_TOP_MARGIN:
		priv->t_margin = g_value_get_float (value);
		break;
	case PROP_PAGE_BOTTOM_MARGIN:
		priv->b_margin = g_value_get_float (value);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
	}

	if (paper_size_changed) {
		g_object_set (object,
			      "ratio", priv->p_width/priv->p_height,
			      NULL);
	}

	update_relative_sizes (PHOTOS_PRINT_PREVIEW (object));
	gtk_widget_queue_draw (priv->area);
}
开发者ID:kleopatra999,项目名称:gnome-photos,代码行数:66,代码来源:photos-print-preview.c


示例19: lowlight_motion_notify

static gboolean lowlight_motion_notify(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
{
  dt_iop_module_t *self = (dt_iop_module_t *)user_data;
  dt_iop_lowlight_gui_data_t *c = (dt_iop_lowlight_gui_data_t *)self->gui_data;
  dt_iop_lowlight_params_t *p = (dt_iop_lowlight_params_t *)self->params;
  const int inset = DT_IOP_LOWLIGHT_INSET;
  GtkAllocation allocation;
  gtk_widget_get_allocation(widget, &allocation);
  int height = allocation.height - 2 * inset, width = allocation.width - 2 * inset;
  if(!c->dragging) c->mouse_x = CLAMP(event->x - inset, 0, width) / (float)width;
  c->mouse_y = 1.0 - CLAMP(event->y - inset, 0, height) / (float)height;
  if(c->dragging)
  {
    *p = c->drag_params;
    if(c->x_move >= 0)
    {
      const float mx = CLAMP(event->x - inset, 0, width) / (float)width;
      if(c->x_move > 0 && c->x_move < DT_IOP_LOWLIGHT_BANDS - 1)
      {
        const float minx = p->transition_x[c->x_move - 1] + 0.001f;
        const float maxx = p->transition_x[c->x_move + 1] - 0.001f;
        p->transition_x[c->x_move] = fminf(maxx, fmaxf(minx, mx));
      }
    }
    else
    {
      dt_iop_lowlight_get_params(p, c->mouse_x, c->mouse_y + c->mouse_pick, c->mouse_radius);
    }
    dt_dev_add_history_item(darktable.develop, self, TRUE);
  }
  else if(event->y > height)
  {
    c->x_move = 0;
    float dist = fabs(p->transition_x[0] - c->mouse_x);
    for(int k = 1; k < DT_IOP_LOWLIGHT_BANDS; k++)
    {
      float d2 = fabs(p->transition_x[k] - c->mouse_x);
      if(d2 < dist)
      {
        c->x_move = k;
        dist = d2;
      }
    }
  }
  else
  {
    c->x_move = -1;
  }
  gtk_widget_queue_draw(widget);
  gint x, y;
#if GTK_CHECK_VERSION(3, 20, 0)
  gdk_window_get_device_position(event->window,
      gdk_seat_get_pointer(gdk_display_get_default_seat(
          gdk_window_get_display(event->window))),
      &x, &y, 0);
#else
  gdk_window_get_device_position(event->window,
                                 gdk_device_manager_get_client_pointer(
                                     gdk_display_get_device_manager(gdk_window_get_display(event->window))),
                                 &x, &y, NULL);
#endif
  return TRUE;
}
开发者ID:CChiappa,项目名称:darktable,代码行数:63,代码来源:lowlight.c


示例20: vfo_update

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gtk_widget_queue_draw_area函数代码示例发布时间:2022-05-28
下一篇:
C++ gtk_widget_override_background_color函数代码示例发布时间:2022-05-28
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap