r5228 chris_y - in /trunk/netsurf/amiga: gui.c gui.h

netsurf at semichrome.net netsurf at semichrome.net
Mon Sep 1 19:03:40 BST 2008


Author: chris_y
Date: Mon Sep  1 13:03:40 2008
New Revision: 5228

URL: http://source.netsurf-browser.org?rev=5228&view=rev
Log:
Add shift and ctrl click support, set file comments to url.

Modified:
    trunk/netsurf/amiga/gui.c
    trunk/netsurf/amiga/gui.h

Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=5228&r1=5227&r2=5228&view=diff
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Sep  1 13:03:40 2008
@@ -401,17 +401,17 @@
 					{
 						if(gwin->mouse_state & BROWSER_MOUSE_PRESS_1)
 						{
-							browser_window_mouse_track(gwin->bw,BROWSER_MOUSE_DRAG_1,x,y);
+							browser_window_mouse_track(gwin->bw,BROWSER_MOUSE_DRAG_1 | gwin->key_state,x,y);
 							gwin->mouse_state = BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
 						}
 						else if(gwin->mouse_state & BROWSER_MOUSE_PRESS_2)
 						{
-							browser_window_mouse_track(gwin->bw,BROWSER_MOUSE_DRAG_2,x,y);
+							browser_window_mouse_track(gwin->bw,BROWSER_MOUSE_DRAG_2 | gwin->key_state,x,y);
 							gwin->mouse_state = BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
 						}
 						else
 						{
-							browser_window_mouse_track(gwin->bw,gwin->mouse_state,x,y);
+							browser_window_mouse_track(gwin->bw,gwin->mouse_state | gwin->key_state,x,y);
 						}
 					}
 				break;
@@ -431,15 +431,14 @@
 						//code = code>>16;
 						switch(code)
 						{
-/* various things aren't implemented here yet, like shift-clicks, ctrl-clicks etc */
 							case SELECTDOWN:
-								browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_PRESS_1,x,y);
+								browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_PRESS_1 | gwin->key_state,x,y);
 								gwin->mouse_state=BROWSER_MOUSE_PRESS_1;
 							break;
 							case SELECTUP:
 								if(gwin->mouse_state & BROWSER_MOUSE_PRESS_1)
 								{
-									browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_CLICK_1,x,y);
+									browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_CLICK_1 | gwin->key_state,x,y);
 								}
 								else
 								{
@@ -448,13 +447,13 @@
 								gwin->mouse_state=0;
 							break;
 							case MIDDLEDOWN:
-								browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_PRESS_2,x,y);
+								browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_PRESS_2 | gwin->key_state,x,y);
 								gwin->mouse_state=BROWSER_MOUSE_PRESS_2;
 							break;
 							case MIDDLEUP:
 								if(gwin->mouse_state & BROWSER_MOUSE_PRESS_2)
 								{
-									browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_CLICK_2,x,y);
+									browser_window_mouse_click(gwin->bw,BROWSER_MOUSE_CLICK_2 | gwin->key_state,x,y);
 								}
 								else
 								{
@@ -560,11 +559,14 @@
 												{
 													strlcpy(&fname,filereq->fr_Drawer,1024);
 													AddPart(&fname,filereq->fr_File,1024);
+													gui_window_set_pointer(gwin,GUI_POINTER_WAIT);
 													if(fh = FOpen(&fname,MODE_NEWFILE,0))
 													{
 														FWrite(fh,gwin->bw->current_content->source_data,1,gwin->bw->current_content->source_size);
 														FClose(fh);
+														SetComment(&fname,gwin->bw->current_content->url);
 													}
+													gui_window_set_pointer(gwin,GUI_POINTER_DEFAULT);
 												}
 											break;
 
@@ -578,7 +580,10 @@
 												{
 													strlcpy(&fname,filereq->fr_Drawer,1024);
 													AddPart(&fname,filereq->fr_File,1024);
+													gui_window_set_pointer(gwin,GUI_POINTER_WAIT);
 													save_as_text(gwin->bw->current_content,&fname);
+													SetComment(&fname,gwin->bw->current_content->url);
+													gui_window_set_pointer(gwin,GUI_POINTER_DEFAULT);
 												}
 											break;
 
@@ -593,9 +598,11 @@
 												{
 													strlcpy(&fname,filereq->fr_Drawer,1024);
 													AddPart(&fname,filereq->fr_File,1024);
-													save_as_text(gwin->bw->current_content,&fname);
+													gui_window_set_pointer(gwin,GUI_POINTER_WAIT);
 													pdf_set_scale(DEFAULT_EXPORT_SCALE);
 													save_as_pdf(gwin->bw->current_content,&fname);
+													SetComment(&fname,gwin->bw->current_content->url);
+													gui_window_set_pointer(gwin,GUI_POINTER_DEFAULT);
 												}
 #endif
 											break;
@@ -692,6 +699,18 @@
 						break;
 						case RAWKEY_ESC:
 							browser_window_key_press(gwin->bw,27);
+						break;
+						case RAWKEY_LSHIFT:
+							gwin->key_state = BROWSER_MOUSE_MOD_1;
+						break;
+						case 0xe0: // lshift up
+							gwin->key_state = 0;
+						break;
+						case RAWKEY_LCTRL:
+							gwin->key_state = BROWSER_MOUSE_MOD_2;
+						break;
+						case 0xe3: // lctrl up
+							gwin->key_state = 0;
 						break;
 					}
 				break;
@@ -1386,6 +1405,8 @@
 
 Object *ami_custom_pointer(gui_pointer_shape shape)
 {
+	if(!mouseptrbm[shape]) printf("%ld is null\n",shape);
+
 	return NewObject(NULL,"pointerclass",POINTERA_BitMap,mouseptrbm[shape],POINTERA_WordWidth,2,POINTERA_XOffset,-mousexpt[shape],POINTERA_YOffset,-mouseypt[shape],POINTERA_XResolution,POINTERXRESN_SCREENRES,POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,TAG_DONE);
 }
 
@@ -1523,6 +1544,8 @@
 		FreeVec(dw);
 		return NULL;
 	}
+
+	SetComment(&fname,url);
 
 	dw->objects[OID_MAIN] = WindowObject,
       	    WA_ScreenTitle,nsscreentitle,
@@ -1743,6 +1766,8 @@
 		i++;
 	}
 
+	gui_window_set_pointer(gwin,GUI_POINTER_DEFAULT); // Clear the menu-style pointer
+
 	IDoMethod(gwin->objects[OID_MENU],PM_OPEN,gwin->win);
 
 }

Modified: trunk/netsurf/amiga/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.h?rev=5228&r1=5227&r2=5228&view=diff
==============================================================================
--- trunk/netsurf/amiga/gui.h (original)
+++ trunk/netsurf/amiga/gui.h Mon Sep  1 13:03:40 2008
@@ -83,6 +83,7 @@
 	struct form_control *control;
 	union content_msg_data *redraw_data;
 	browser_mouse_state mouse_state;
+	browser_mouse_state key_state;
 	int c_x;
 	int c_y;
 	int c_h;




More information about the netsurf-commits mailing list