[DEVELOPMENT ENVIRONMENT]

* BUG: Fix a possible crash in form editor arrangement icons managemnt.

[GB.GTK]
* NEW: DrawingArea.UseTablet has been renamed as DrawingArea.Tablet.
* NEW: Pointer.ScreenX and Pointer.ScreenY are two new properties that 
  replace Pointer.X and Pointer.Y. Pointer.X and Pointer.Y are yet there, 
  but now they return the pointer position relative to the control 
  receiving the event.
* BUG: Try to activate all XInput devices when the DrawingArea.Tablet
  property is set.

[GB.QT4]
* NEW: DrawingArea.UseTablet has been renamed as DrawingArea.Tablet.
* NEW: Pointer.ScreenX and Pointer.ScreenY are two new properties that 
  replace Pointer.X and Pointer.Y. Pointer.X and Pointer.Y are yet there, 
  but now they return the pointer position relative to the control 
  receiving the event.


git-svn-id: svn://localhost/gambas/trunk@5051 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-08-17 15:53:52 +00:00
parent 52929cd0e6
commit 0388831b8c
10 changed files with 96 additions and 9 deletions

1
TODO
View File

@ -33,7 +33,6 @@ DEBUGGER
DEVELOPMENT ENVIRONMENT
- Bookmarks in editor.
- Manage Object properties in IDE.
- Make a visual control clipboard.
- Generates an index control->component to suggest components for missing controls.

View File

@ -316,6 +316,9 @@ End
Public Sub Timer_Timer()
CheckIcons
Finally
$bTrigger = False
End

View File

@ -162,7 +162,7 @@ BEGIN_METHOD(DrawingArea_Refresh, GB_INTEGER x; GB_INTEGER y; GB_INTEGER w; GB_I
END_METHOD
BEGIN_PROPERTY(DrawingArea_UseTablet)
BEGIN_PROPERTY(DrawingArea_Tablet)
if (READ_PROPERTY)
GB.ReturnBoolean(WIDGET->useTablet());
@ -191,7 +191,7 @@ GB_DESC CDrawingAreaDesc[] =
GB_PROPERTY("Painted", "b", CDRAWINGAREA_painted),
GB_PROPERTY("NoBackground", "b", DrawingArea_NoBackground),
GB_PROPERTY("UseTablet", "b", DrawingArea_UseTablet),
GB_PROPERTY("Tablet", "b", DrawingArea_Tablet),
GB_METHOD("Clear", 0, CDRAWINGAREA_clear, NULL),
GB_METHOD("Refresh", NULL, DrawingArea_Refresh, "[(X)i(Y)i(Width)i(Height)i]"),

View File

@ -231,17 +231,31 @@ END_METHOD
//-------------------------------------------------------------------------
BEGIN_PROPERTY(Pointer_ScreenX)
CHECK_VALID();
GB.ReturnFloat(gMouse::getPointerScreenX());
END_PROPERTY
BEGIN_PROPERTY(Pointer_ScreenY)
CHECK_VALID();
GB.ReturnFloat(gMouse::getPointerScreenY());
END_PROPERTY
BEGIN_PROPERTY(Pointer_X)
CHECK_VALID();
GB.ReturnFloat(gMouse::getAxis(GDK_AXIS_X));
GB.ReturnFloat(gMouse::getPointerX());
END_PROPERTY
BEGIN_PROPERTY(Pointer_Y)
CHECK_VALID();
GB.ReturnFloat(gMouse::getAxis(GDK_AXIS_Y));
GB.ReturnFloat(gMouse::getPointerY());
END_PROPERTY
@ -370,6 +384,8 @@ GB_DESC CPointerDesc[] =
GB_STATIC_PROPERTY_READ("Type", "i", Pointer_Type),
GB_STATIC_PROPERTY_READ("X", "f", Pointer_X),
GB_STATIC_PROPERTY_READ("Y", "f", Pointer_Y),
GB_STATIC_PROPERTY_READ("ScreenX", "f", Pointer_ScreenX),
GB_STATIC_PROPERTY_READ("ScreenY", "f", Pointer_ScreenY),
GB_STATIC_PROPERTY_READ("XTilt", "f", Pointer_XTilt),
GB_STATIC_PROPERTY_READ("YTitt", "f", Pointer_YTilt),
GB_STATIC_PROPERTY_READ("Pressure", "f", Pointer_Pressure),

View File

@ -23,6 +23,7 @@
#include "widgets.h"
#include "gdraw.h"
#include "gmouse.h"
#include "gdrawingarea.h"
/****************************************************************************************
@ -370,6 +371,8 @@ void gDrawingArea::setRealBackground(gColor color)
void gDrawingArea::updateUseTablet()
{
if (_use_tablet)
gMouse::initDevices();
gtk_widget_set_extension_events(widget, _use_tablet ? GDK_EXTENSION_EVENTS_ALL : GDK_EXTENSION_EVENTS_NONE);
}

View File

@ -242,3 +242,47 @@ int gMouse::getType()
default: return POINTER_MOUSE;
}
}
void gMouse::initDevices()
{
static bool done = false;
GList *devices;
GdkDevice *device;
if (done)
return;
devices = gdk_devices_list();
while (devices)
{
device = (GdkDevice *)devices->data;
fprintf(stderr, "%s\n", gdk_device_get_name(device));
gdk_device_set_mode(device, GDK_MODE_SCREEN);
devices = devices->next;
}
done = true;
}
double gMouse::getPointerX()
{
return ((GdkEventMotion *)_event)->x;
}
double gMouse::getPointerY()
{
return ((GdkEventMotion *)_event)->y;
}
double gMouse::getPointerScreenX()
{
return getAxis(GDK_AXIS_X);
}
double gMouse::getPointerScreenY()
{
return getAxis(GDK_AXIS_Y);
}

View File

@ -51,6 +51,12 @@ public:
static double getAxis(GdkAxisUse axis);
static int getType();
static double getPointerX();
static double getPointerY();
static double getPointerScreenX();
static double getPointerScreenY();
static void initDevices();
//"Methods"
static void move(int x, int y);

View File

@ -42,7 +42,7 @@
#define CCOLUMNVIEW_PROPERTIES "*,Mode{Select.*}=Single,Sorted,Editable,Header=True,Resizable=False,AutoResize=True,Border=True,ScrollBar{Scroll.*}=Both"
#define CCOMBOBOX_PROPERTIES "*,Action,ReadOnly,List,Text,Password,MaxLength,Sorted"
#define CDIAL_PROPERTIES "*,MinValue=0,MaxValue=100,Step=1,PageStep=10,Wrap,Mark=True"
#define CDRAWINGAREA_PROPERTIES "*," CARRANGEMENT_PROPERTIES ",Border{Border.*},Cached,Painted,Focus,NoBackground,UseTablet"
#define CDRAWINGAREA_PROPERTIES "*," CARRANGEMENT_PROPERTIES ",Border{Border.*},Cached,Painted,Focus,NoBackground,Tablet"
#define CEDITOR_PROPERTIES "*,Font{Font:Fixed},Border=True,ScrollBar{Scroll.*}=Both,Highlight{Highlight.None;Custom;Gambas;HTML;CSS;WebPage;Diff;JavaScript;SQL}=None,ReadOnly=False,TabSize{Range:1;16}=2"
#define CFRAME_PROPERTIES "*,Text"
#define CGRIDVIEW_PROPERTIES "*,Mode{Select.None;Single;Multiple}=None,Grid=True,Header{GridView.None;Vertical;Horizontal;Both}=None,Scrollbar{Scroll.*}=Both,Border=True,AutoResize=True,Resizable=True"

View File

@ -639,7 +639,7 @@ BEGIN_METHOD(DrawingArea_Refresh, GB_INTEGER x; GB_INTEGER y; GB_INTEGER w; GB_I
END_METHOD
BEGIN_PROPERTY(DrawingArea_UseTablet)
BEGIN_PROPERTY(DrawingArea_Tablet)
if (READ_PROPERTY)
GB.ReturnBoolean(THIS->widget.flag.use_tablet);
@ -671,7 +671,7 @@ GB_DESC CDrawingAreaDesc[] =
GB_PROPERTY("Focus", "b", CDRAWINGAREA_focus),
GB_PROPERTY("Enabled", "b", CDRAWINGAREA_enabled),
GB_PROPERTY("Painted", "b", CDRAWINGAREA_painted),
GB_PROPERTY("UseTablet", "b", DrawingArea_UseTablet),
GB_PROPERTY("Tablet", "b", DrawingArea_Tablet),
GB_METHOD("Clear", NULL, CDRAWINGAREA_clear, NULL),
GB_METHOD("Refresh", NULL, DrawingArea_Refresh, "[(X)i(Y)i(Width)i(Height)i]"),

View File

@ -336,12 +336,26 @@ END_METHOD
BEGIN_PROPERTY(Pointer_X)
CHECK_VALID();
GB.ReturnFloat(CMOUSE_info.tx);
GB.ReturnFloat((double)CMOUSE_info.x + (CMOUSE_info.tx - (int)CMOUSE_info.tx));
END_PROPERTY
BEGIN_PROPERTY(Pointer_Y)
CHECK_VALID();
GB.ReturnFloat((double)CMOUSE_info.y + (CMOUSE_info.ty - (int)CMOUSE_info.ty));
END_PROPERTY
BEGIN_PROPERTY(Pointer_ScreenX)
CHECK_VALID();
GB.ReturnFloat(CMOUSE_info.tx);
END_PROPERTY
BEGIN_PROPERTY(Pointer_ScreenY)
CHECK_VALID();
GB.ReturnFloat(CMOUSE_info.ty);
@ -474,6 +488,8 @@ GB_DESC CPointerDesc[] =
GB_STATIC_PROPERTY_READ("Type", "i", Pointer_Type),
GB_STATIC_PROPERTY_READ("X", "f", Pointer_X),
GB_STATIC_PROPERTY_READ("Y", "f", Pointer_Y),
GB_STATIC_PROPERTY_READ("ScreenX", "f", Pointer_ScreenX),
GB_STATIC_PROPERTY_READ("ScreenY", "f", Pointer_ScreenY),
GB_STATIC_PROPERTY_READ("XTilt", "f", Pointer_XTilt),
GB_STATIC_PROPERTY_READ("YTitt", "f", Pointer_YTilt),
GB_STATIC_PROPERTY_READ("Pressure", "f", Pointer_Pressure),