Beispiel #1
0
static PyObject *
PyDiaDisplay_ResizeCanvas(PyDiaDisplay *self, PyObject *args)
{
    int width, height;

    if (!PyArg_ParseTuple(args, "ii:Display.resize_canvas", &width,&height))
	return NULL;
    ddisplay_resize_canvas(self->disp, width, height);
    Py_INCREF(Py_None);
    return Py_None;
}
Beispiel #2
0
/*!
 * Called when the widget's window "size, position or stacking"
 * changes. Needs GDK_STRUCTURE_MASK set.
 */
static gboolean
canvas_configure_event (GtkWidget         *widget,
			GdkEventConfigure *cevent,
			DDisplay          *ddisp)
{
  gboolean new_size = FALSE;
  int width, height;

  g_return_val_if_fail (widget == ddisp->canvas, FALSE);


  if (ddisp->renderer) {
    width = dia_renderer_get_width_pixels (ddisp->renderer);
    height = dia_renderer_get_height_pixels (ddisp->renderer);
  } else {
    /* We can continue even without a renderer here because
     * ddisplay_resize_canvas () does the setup for us.
     */
    width = height = 0;
  }

  /* Only do this when size is really changing */
  if (width != cevent->width || height != cevent->height) {
    g_print ("Canvas size change...\n");
    ddisplay_resize_canvas (ddisp, cevent->width, cevent->height);
    ddisplay_update_scrollbars(ddisp);
    /* on resize stop further propagation - does not help */
    new_size = TRUE;
  }

  /* If the UI is not integrated, resizing should set the resized
   * window as active.  With integrated UI, there is only one window.
   */
  if (is_integrated_ui () == 0)
    display_set_active(ddisp);

  /* continue propagation with FALSE */
  return new_size;
}