Beispiel #1
0
void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i) {
	wimp_window_state state;
	wimp_icon_state icon_state;
	state.w = w;
	icon_state.w = w;
	icon_state.i = i;
	wimp_get_window_state(&state);
	wimp_get_icon_state(&icon_state);
	menu_icon = i;
	ro_gui_create_menu(menu,
			state.visible.x0 + icon_state.icon.extent.x1 + 64,
			state.visible.y1 + icon_state.icon.extent.y1);
}
Beispiel #2
0
void tag_cloud_sync(tag_cloud *tc, tag_cloud_sync_flags flags)
{
  wimp_window_state state;
  int               visible_width;
  int               old_width, old_height;

  state.w = tc->main_w;
  wimp_get_window_state(&state);

  /* do nothing if the window is closed */

  if ((flags & tag_cloud_SYNC_OPEN_TOP) == 0 &&
      (state.flags & wimp_WINDOW_OPEN) == 0)
    return;

  /* layout to fit the visible width */

  visible_width = state.visible.x1 - state.visible.x0;

  old_width  = tc->layout.width;
  old_height = tc->layout.height;

  (void) tag_cloud_layout(tc, visible_width); // error ignored

  /* set extent if the vertical size has changed */

  if ((flags & (tag_cloud_SYNC_OPEN_TOP | tag_cloud_SYNC_EXTENT)) != 0 ||
      tc->layout.height != old_height)
  {
    os_box box;

    box.x0 = 0;
    box.y0 = -tc->layout.height;
    box.x1 = 16384;
    box.y1 = 0;

    tag_cloud_toolbar_adjust_extent(tc, &box);

    wimp_set_extent(tc->main_w, &box);

    if (flags & tag_cloud_SYNC_OPEN_TOP)
      state.next = wimp_TOP;

    /* have to re-kick after extent change */
    wimp_open_window((wimp_open *) &state);
  }

  if ((flags & tag_cloud_SYNC_REDRAW) != 0 ||
      ((flags & tag_cloud_SYNC_REDRAW_IF_LAYOUT) != 0 && (tc->layout.width != old_width)))
    wimp_force_redraw(tc->main_w, 0, -16384, 16384, 0);
}
Beispiel #3
0
static int filerwin_event_user_drag_box(wimp_event_no event_no,
                                        wimp_block   *block,
                                        void         *handle)
{
  wimp_dragged *dragged;
  filerwin     *fw;

  NOT_USED(event_no);

  dragged = &block->dragged;
  fw      = handle;

  if (fw->drag_type == drag_type_SELECTION_SELECT ||
      fw->drag_type == drag_type_SELECTION_ADJUST)
  {
    wimp_version_no    version;
    mapfn             *selector;
    wimp_window_state  wstate;

    xwimpreadsysinfo_version(&version);

    if (version >= wimp_VERSION_RO40)
      wimp_auto_scroll(0, NULL);

    // convert dragged.final to workarea relative
    // (note fiddling with dragged->final in place)

    wstate.w = fw->w;
    wimp_get_window_state(&wstate);

    screen_box_to_workarea(&dragged->final, &wstate);

    // for each icon: do we hit it?

    if (fw->drag_type == drag_type_SELECTION_SELECT)
    {
      bitvec_clear_all(fw->selection);
      selector = select_bobs;
    }
    else
    {
      selector = adjust_bobs;
    }

    map(fw, selector, 0,0, &dragged->final, NULL);


    fw->drag_type = -1;
  }
Beispiel #4
0
error tags_search_open(void)
{
  error             err;
  wimp_w            w;
  wimp_window_state state;

  /* load the databases, create tag cloud, etc. */

  err = tags_search_lazyinit();
  if (err)
    return err;

  w = LOCALS.tags_search_w;

  state.w = w;
  wimp_get_window_state(&state);
  if (state.flags & wimp_WINDOW_OPEN)
  {
    /* bring to front and gain focus */

    state.next = wimp_TOP;
    wimp_open_window((wimp_open *) &state);
  }
  else
  {
    /* opening for the first(?) time */

    /* tags_search_update_dialogue(); */

    window_open_at(w, AT_BOTTOMPOINTER);

    search_attach_child(w, tag_cloud_get_window_handle(LOCALS.tc), 2);
  }

  return error_OK;
}
Beispiel #5
0
static error search_attach_child(wimp_w parent, wimp_w child, wimp_i icon)
{
  wimp_window_state         pstate;
  wimp_icon_state           istate;
  wimp_window_nesting_flags linkage;
  wimp_window_state         cstate;
  wimp_outline              coutline;

  pstate.w = parent;
  wimp_get_window_state(&pstate);

  istate.w = parent;
  istate.i = icon;
  wimp_get_icon_state(&istate);

  cstate.w = child;
  wimp_get_window_state(&cstate);

  coutline.w = child;
  wimp_get_window_outline(&coutline);

  /* record window furniture sizes */
  coutline.outline.x0 -= cstate.visible.x0;
  coutline.outline.y0 -= cstate.visible.y0;
  coutline.outline.x1 -= cstate.visible.x1;
  coutline.outline.y1 -= cstate.visible.y1;

  /* scr to wrk: wrk_x = scr_x + xscroll - visible_x0 */
  /* wrk to scr: scr_x = wrk_x - xscroll + visible_x0 */

  cstate.visible.x0 = istate.icon.extent.x0 - pstate.xscroll + pstate.visible.x0;
  cstate.visible.y0 = istate.icon.extent.y0 - pstate.yscroll + pstate.visible.y1;
  cstate.visible.x1 = istate.icon.extent.x1 - pstate.xscroll + pstate.visible.x0;
  cstate.visible.y1 = istate.icon.extent.y1 - pstate.yscroll + pstate.visible.y1;

  /* adjust for furniture */
  cstate.visible.x0 -= coutline.outline.x0;
  cstate.visible.y0 -= coutline.outline.y0;
  cstate.visible.x1 -= coutline.outline.x1;
  cstate.visible.y1 -= -coutline.outline.y0; /* the title bar is removed when
                                                we open the window, so use
                                                the bottom edge as a guide */

  cstate.next   = wimp_TOP;
  cstate.flags &= ~(wimp_WINDOW_AUTO_REDRAW |
                    wimp_WINDOW_BACK_ICON   |
                    wimp_WINDOW_CLOSE_ICON  |
                    wimp_WINDOW_TITLE_ICON  |
                    wimp_WINDOW_TOGGLE_ICON |
                    wimp_WINDOW_SIZE_ICON   |
                    wimp_WINDOW_HSCROLL);

  linkage = (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_LS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_BS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_RS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_TS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_XORIGIN_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_YORIGIN_SHIFT);

  wimp_open_window_nested_with_flags(&cstate, parent, linkage);

  return error_OK;
}