2003-10-01 04:26:42 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
|
|
|
*/
|
|
|
|
|
2003-12-27 03:11:57 +03:00
|
|
|
#include <string.h>
|
2003-10-01 04:26:42 +04:00
|
|
|
#include "oslib/wimp.h"
|
|
|
|
#include "netsurf/riscos/gui.h"
|
2003-10-06 03:30:21 +04:00
|
|
|
#include "netsurf/utils/log.h"
|
|
|
|
#include "netsurf/utils/utils.h"
|
|
|
|
|
2003-10-01 04:26:42 +04:00
|
|
|
|
|
|
|
void ro_gui_start_selection(wimp_pointer *pointer, wimp_window_state *state,
|
2004-02-26 03:44:42 +03:00
|
|
|
gui_window *g)
|
2003-10-01 04:26:42 +04:00
|
|
|
{
|
2004-02-26 03:44:42 +03:00
|
|
|
wimp_drag drag;
|
|
|
|
|
|
|
|
gui_current_drag_type = GUI_DRAG_SELECTION;
|
|
|
|
current_gui = g;
|
|
|
|
|
|
|
|
drag.type = wimp_DRAG_USER_POINT;
|
|
|
|
drag.initial.x0 = pointer->pos.x;
|
|
|
|
drag.initial.y0 = pointer->pos.y;
|
|
|
|
drag.initial.x1 = pointer->pos.x;
|
|
|
|
drag.initial.y1 = pointer->pos.y;
|
|
|
|
drag.bbox.x0 = state->visible.x0;
|
|
|
|
drag.bbox.y0 = state->visible.y0;
|
|
|
|
drag.bbox.x1 = state->visible.x1;
|
|
|
|
drag.bbox.y1 = state->visible.y1;
|
|
|
|
wimp_drag_box(&drag);
|
2003-10-01 04:26:42 +04:00
|
|
|
}
|
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
|
|
|
|
void ro_gui_selection_drag_end(wimp_dragged *drag)
|
2003-10-01 04:26:42 +04:00
|
|
|
{
|
|
|
|
struct browser_action msg;
|
|
|
|
int final_x0, final_y0;
|
|
|
|
wimp_window_state state;
|
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
state.w = current_gui->window;
|
2003-10-01 04:26:42 +04:00
|
|
|
wimp_get_window_state(&state);
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
final_x0 = window_x_units(drag->final.x0, &state) / 2;
|
|
|
|
final_y0 = window_y_units(drag->final.y0, &state) / 2;
|
2003-10-01 04:26:42 +04:00
|
|
|
|
|
|
|
msg.data.mouse.x = final_x0;
|
|
|
|
msg.data.mouse.y = final_y0;
|
|
|
|
msg.type = act_ALTER_SELECTION;
|
2004-02-26 03:44:42 +03:00
|
|
|
browser_window_action(current_gui->data.browser.bw, &msg);
|
2003-10-01 04:26:42 +04:00
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
if (box_position_eq(&(current_gui->data.browser.bw->current_content->data.html.text_selection.start),
|
|
|
|
&(current_gui->data.browser.bw->current_content->data.html.text_selection.end)))
|
2003-10-01 04:26:42 +04:00
|
|
|
{
|
|
|
|
msg.type = act_CLEAR_SELECTION;
|
2004-02-26 03:44:42 +03:00
|
|
|
browser_window_action(current_gui->data.browser.bw, &msg);
|
2003-10-01 04:26:42 +04:00
|
|
|
}
|
2004-02-26 03:44:42 +03:00
|
|
|
current_gui->drag_status = drag_NONE;
|
|
|
|
current_gui->data.browser.bw->current_content->data.html.text_selection.altering = alter_UNKNOWN;
|
2003-10-01 04:26:42 +04:00
|
|
|
}
|
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2003-10-01 04:26:42 +04:00
|
|
|
void ro_gui_copy_selection(gui_window* g)
|
|
|
|
{
|
|
|
|
if (g->type == GUI_BROWSER_WINDOW)
|
|
|
|
{
|
|
|
|
// if (g->data.browser.bw->text_selection->selected == 1)
|
|
|
|
// {
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|