Commit 48b6c492 authored by Martin Schreiber's avatar Martin Schreiber

Merge from master.

parents 81afd38f fc1ee055
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -267,6 +267,7 @@ type
end;
procedure querytoupdateparams(const source: tsqlquery; const dest: tparams);
function SkipComments(var p: PmseChar) : boolean;
implementation
uses
......
{ MSEgui Copyright (c) 1999-2014 by Martin Schreiber
{ MSEgui Copyright (c) 1999-2018 by Martin Schreiber
See the file COPYING.MSE, included in this distribution,
for details about the copyright.
......@@ -27,6 +27,9 @@ type
dragovereventty = procedure(const asender: tobject; const apos: pointty;
var adragobject: tdragobject; var accept: boolean;
var processed: boolean) of object;
dragendeventty = procedure(const asender: tobject; const apos: pointty;
var adragobject: tdragobject; const accepted: boolean;
var processed: boolean) of object;
ttagdragobject = class(tdragobject)
private
......@@ -60,11 +63,14 @@ type
const
dragstates = [ds_clicked,ds_beginchecked,ds_haddragobject];
sdndexpiretime = 5000000; //5s
dragmindist = 4;
type
drageventsty = record
dragbegin: drageventty;
dragover: dragovereventty;
dragdrop: drageventty;
dragend: dragendeventty;
end;
sysdndinfoty = record
......@@ -72,7 +78,7 @@ type
// expiretime: longword;
end;
dragoptionty = (do_child);
dragoptionty = (do_child,do_nocursorshape,do_nearstart,do_mousewidget);
dragoptionsty = set of dragoptionty;
tcustomdragcontroller = class(tlinkedpersistent,ievent)
......@@ -135,12 +141,16 @@ type
write fonbefore.dragover;
property onbeforedragdrop: drageventty read fonbefore.dragdrop
write fonbefore.dragdrop;
property onbeforedragend: dragendeventty read fonbefore.dragend
write fonbefore.dragend;
property onafterdragbegin: drageventty read fonafter.dragbegin
write fonafter.dragbegin;
property onafterdragover: dragovereventty read fonafter.dragover
write fonafter.dragover;
property onafterdragdrop: drageventty read fonafter.dragdrop
write fonafter.dragdrop;
property onafterdragend: dragendeventty read fonafter.dragend
write fonafter.dragend;
property options;
end;
......@@ -199,9 +209,21 @@ end;
procedure tcustomdragcontroller.enddrag;
var
int1,int2: integer;
draginfo: draginfoty;
owner: twidget;
po1: pointty;
begin
// checksysdnd(sdnda_finished,nullrect);
if fdragobject <> nil then begin
owner:= fintf.getwidget();
if dos_dropped in fdragobject.state then begin
po1:= translateclientpoint(fdragobject.droppos,nil,owner);
end
else begin
po1:= fdragobject.pickpos;
end;
initdraginfo(draginfo,dek_end,po1);
owner.dragevent(draginfo);
if dos_sysdroppending in tdragobject1(fdragobject).fstate then begin
int2:= 0;
for int1:= 0 to high(fsysdndobjects) do begin
......@@ -231,7 +253,9 @@ begin
end;
end;
if ds_haddragobject in fstate then begin
application.cursorshape:= cr_default;
if not (do_nocursorshape in foptions) then begin
application.cursorshape:= cr_default;
end;
end;
application.unregisteronkeypress(@dokeypress);
fstate:= fstate - dragstates;
......@@ -254,12 +278,23 @@ var
info: draginfoty;
begin
result:= nil;
window:= nil;
pt1:= translateclientpoint(pos,fintf.getwidget,nil);
window:= application.windowatpos(pt1);
if do_mousewidget in foptions then begin
result:= application.mousewidget;
if result <> nil then begin
window:= result.window;
end;
end
else begin
window:= application.windowatpos(pt1);
if window <> nil then begin
result:= window.owner.widgetatpos(translatewidgetpoint(pt1,nil,window.owner),
[ws_visible,ws_enabled]);
end;
end;
if window <> nil then begin
sysdndpending:= false;
result:= window.owner.widgetatpos(translatewidgetpoint(pt1,nil,window.owner),
[ws_visible,ws_enabled]);
if (flastwidget <> result) then begin
if (flastwidget <> nil) then begin
initdraginfo(info,dek_leavewidget,
......@@ -290,6 +325,9 @@ begin
info.clientpickpos:= fpickpos;
info.pickpos:= translateclientpoint(fpickpos,fintf.getwidget,nil);
info.dragobjectpo:= @fdragobject;
if (eventkind = dek_drop) and (fdragobject <> nil) then begin
include(tdragobject1(fdragobject).fstate,dos_dropped);
end;
end;
function tcustomdragcontroller.checkclickstate(
......@@ -313,7 +351,15 @@ begin
ek_buttonpress: begin
if checkclickstate(info) then begin
fpickpos:= info.pos;
fpickrect:= fintf.getdragrect(fpickpos);
if do_nearstart in foptions then begin
fpickrect.x:= info.pos.x - dragmindist;
fpickrect.y:= info.pos.y - dragmindist;
fpickrect.cx:= 2 * dragmindist;
fpickrect.cy:= 2 * dragmindist;
end
else begin
fpickrect:= fintf.getdragrect(fpickpos);
end;
include(fstate,ds_clicked);
end;
end;
......@@ -363,12 +409,16 @@ begin
tdragobject1(fdragobject).feventintf:= ievent(self);
include(info.eventstate,es_processed);
if checkcandragdrop(info.pos,bo1) <> nil then begin
application.cursorshape:= cr_drag;
if not (do_nocursorshape in foptions) then begin
application.cursorshape:= cr_drag;
end;
fdragobject.acepted(translateclientpoint(info.pos,owner,nil));
end
else begin
if not bo1 then begin
application.cursorshape:= cr_forbidden;
if not (do_nocursorshape in foptions) then begin
application.cursorshape:= cr_forbidden;
end;
fdragobject.refused(translateclientpoint(info.pos,owner,nil));
end;
end;
......@@ -411,11 +461,13 @@ begin
if (fdragobject <> nil) and (aevent is tsysdndstatusevent) then begin
with tsysdndstatusevent(aevent) do begin
if ds_beginchecked in fstate then begin
if accept then begin
application.cursorshape:= cr_drag;
end
else begin
application.cursorshape:= cr_forbidden;
if not (do_nocursorshape in foptions) then begin
if accept then begin
application.cursorshape:= cr_drag;
end
else begin
application.cursorshape:= cr_forbidden;
end;
end;
end;
end;
......@@ -480,6 +532,12 @@ begin
dragdrop(fintf.getwidget,pos,dragobjectpo^,result);
end;
end;
dek_end: begin
if assigned(dragend) then begin
dragend(fintf.getwidget,pos,dragobjectpo^,(dragobjectpo^ <> nil) and
(dos_dropped in dragobjectpo^.state),result);
end;
end;
end;
end;
end;
......
......@@ -23,7 +23,6 @@ uses
procedure reggroups;
begin
registerunitgroup(['msegui'],['msegraphics','msegraphutils']);
registerunitgroup(['mseskin'],['mseclasses']);
registerunitgroup(['mseedit'],['msegui','msemenus','mseguiglob','msegraphics','mseapplication','sysutils','msestat','msestatfile','msetypes','msestream']);
......@@ -32,7 +31,7 @@ begin
registerunitgroup(['msedataedits'],['msegui','msemenus','mseguiglob','msegraphics','msetypes','mseedit','mseificomp','mseifiglob','mseglob','mseificompglob','mseact','msedropdownlist']);
registerunitgroup(['msegraphedits'],['msegui','msemenus','mseguiglob','msegraphics','msescrollbar','msetypes','mseificomp','mseifiglob','mseglob','mseificompglob']);
registerunitgroup(['msesimplewidgets'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','msegraphutils','msewidgets']);
registerunitgroup(['msegrids'],['msegui','msemenus','mseguiglob','msegraphics','msetypes']);
registerunitgroup(['msegrids'],['msegui','msemenus','mseguiglob','msegraphics','msedragglob','msetypes']);
registerunitgroup(['msewidgets'],['msegui','msemenus','mseguiglob','msegraphics']);
registerunitgroup(['mseificomp'],['mseifiglob','mseglob','mseificompglob']);
registerunitgroup(['mseactions'],['mseclasses']);
......@@ -63,7 +62,7 @@ begin
registerunitgroup(['mseprinter'],['msegui','msemenus','mseguiglob','msegraphics','msedataedits','msetypes','mseedit']);
registerunitgroup(['mseimage'],['msegui','msemenus','mseguiglob','msegraphics']);
registerunitgroup(['msedial'],['msegui','msemenus','mseguiglob','msegraphics']);
registerunitgroup(['msewindowwidget'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','msegraphutils']);
registerunitgroup(['msewindowwidget'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','msetypes','msegraphutils']);
registerunitgroup(['msechart'],['msegui','msemenus','mseguiglob','msegraphics','msegraphutils']);
registerunitgroup(['msepolygon'],['msegui','msemenus','mseguiglob','msegraphics','msegraphutils']);
registerunitgroup(['msepickwidget'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','mseobjectpicker','msepointer','msetypes']);
......@@ -71,8 +70,8 @@ begin
registerunitgroup(['msedockpanelform'],['msetypes','msemenus','mseclasses']);
registerunitgroup(['msechartedit'],['msegui','msemenus','mseguiglob','msegraphics','msegraphutils','msetypes']);
registerunitgroup(['msebarcode'],['msegui','msemenus','mseguiglob','msegraphics']);
registerunitgroup(['mseopenglwidget'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','msegraphutils','msewindowwidget']);
registerunitgroup(['mseopenglcanvaswidget'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','msegraphutils','msewindowwidget']);
registerunitgroup(['mseopenglwidget'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','msegraphutils','msewindowwidget','msetypes']);
registerunitgroup(['mseopenglcanvaswidget'],['msegui','msemenus','mseguiglob','msegraphics','mseclasses','msegraphutils','msewindowwidget','msetypes']);
registerunitgroup(['msedb'],['mdb','msetypes','mseifiglob']);
registerunitgroup(['msegdiprint'],['mseprinter']);
registerunitgroup(['mseterminal'],['msegui','msemenus','mseguiglob','msegraphics','mseedit','msetypes','msetextedit','mseeditglob','msegrids','mserichstring']);
......@@ -120,7 +119,6 @@ begin
registerunitgroup(['msedbf'],['mdbf','dbf_idxfile','mdb']);
registerunitgroup(['msesdfdata'],['mdb']);
registerunitgroup(['msememds'],['mdb']);
end;
initialization
......
......@@ -300,7 +300,8 @@ begin
registerpropertyeditor(typeinfo(optionsdockty),nil,'',
toptionsdockeditor);
registerunitgroup(['msegrids'],['msegui','msegraphutils','mseclasses']);
registerunitgroup(['msegrids'],['msegui','msegraphutils','mseclasses',
'msegridsglob']);
registerunitgroup(['msewidgetgrid'],['msedataedits',
'msegui','msegraphutils','mseclasses']);
......
......@@ -14,7 +14,7 @@ uses
mseglob,msegraphutils,mseguiglob,mseevent;
type
dragobjstatety = (dos_sysdnd,dos_write,dos_sysdroppending);
dragobjstatety = (dos_dropped,dos_sysdnd,dos_write,dos_sysdroppending);
dragobjstatesty = set of dragobjstatety;
pdragobject = ^tdragobject;
......@@ -22,6 +22,7 @@ type
private
fpickpos: pointty;
fdroppos: pointty;
function getdropped: boolean;
protected
finstancepo: pdragobject;
fsender: tobject;
......@@ -35,20 +36,21 @@ type
function geteventintf: ievent;
public
constructor create(const asender: tobject; var instance: tdragobject;
const apickpos: pointty;
const apickpos: pointty; //clientorigin
const aactions: dndactionsty = []);
destructor destroy; override;
function sender: tobject;
procedure acepted(const apos: pointty); virtual; //screenorigin
procedure refused(const apos: pointty); virtual; //screenorigin
property pickpos: pointty read fpickpos write fpickpos; //screenorigin
property pickpos: pointty read fpickpos write fpickpos; //clientorigin
property droppos: pointty read fdroppos write fdroppos; //screenorigin
property state: dragobjstatesty read fstate;
property dropped: boolean read getdropped;
property actions: dndactionsty read factions write factions;
end;
drageventkindty = (dek_begin,dek_check,dek_drop,dek_leavesysdnd,
dek_leavewidget);
drageventkindty = (dek_begin,dek_check,dek_drop,dek_end,
dek_leavesysdnd,dek_leavewidget);
draginfoty = record
eventkind: drageventkindty;
......@@ -74,8 +76,10 @@ constructor tdragobject.create(const asender: tobject; var instance: tdragobject
begin
fsender:= asender;
finstancepo:= @instance;
instance.Free;
instance:= self;
if finstancepo <> nil then begin
instance.Free;
instance:= self;
end;
fpickpos:= apickpos;
factions:= aactions;
tguiapplication1(application).dragstarted;
......@@ -90,6 +94,11 @@ begin
inherited;
end;
function tdragobject.getdropped: boolean;
begin
result:= dos_dropped in fstate;
end;
procedure tdragobject.acepted(const apos: pointty);
begin
//dummy
......
{ MSEgui Copyright (c) 1999-2017 by Martin Schreiber
{ MSEgui Copyright (c) 1999-2018 by Martin Schreiber
See the file COPYING.MSE, included in this distribution,
for details about the copyright.
......
......@@ -100,6 +100,7 @@ const
rowstatefoldleveltag = 0;
rowstateissumtag = 1;
rowstatefoldhiddentag = 2;
gridautosizetag = 3;
type
optiongridty = (og_colsizing,og_colmoving,og_keycolmoving,
......@@ -248,6 +249,7 @@ type
gs1_sortmoving,gs1_sortchangelock,gs1_rowinserted,
gs1_gridsorted,gs1_dbsorted,gs1_customsort,
gs1_rowdeleting,gs1_autoappending,gs1_autoremoving,
gs1_autosizepending,
gs1_focuscellonenterlock,gs1_mousecaptureendlock,
gs1_forcenullcheck,
gs1_cellsizesyncing,gs1_userinput,gs1_autoappendlock,
......@@ -770,15 +772,41 @@ type
datacolaty = array[0..0] of tdatacol;
pdatacolaty = ^datacolaty;
tcelldragobject = class(tdragobject)
private
fgrid: tcustomgrid;
fcell: gridcoordty;
public
constructor create(const draginfo: draginfoty; const cellinfo: cellinfoty);
constructor create(const agrid: tcustomgrid;
var ainstance: tdragobject; const apos: pointty);
property grid: tcustomgrid read fgrid;
property cell: gridcoordty read fcell;
end;
celldrageventty = procedure(const cellinfo: cellinfoty;
var draginfo: draginfoty; var dragobject: tcelldragobject;
var accept: boolean; var processed: boolean) of object;
tdrawcol = class(tdatacol)
private
fondrawcell: drawcelleventty;
fonbeforedragevent: celldrageventty;
fonafterdragevent: celldrageventty;
protected
procedure drawcell(const canvas: tcanvas); override;
procedure beforedragevent(var ainfo: draginfoty; const arow: integer;
var processed: boolean) override;
procedure afterdragevent(var ainfo: draginfoty; const arow: integer;
var processed: boolean) override;
published
property focusrectdist;
property ondrawcell: drawcelleventty read fondrawcell write fondrawcell;
property onbeforedragevent: celldrageventty read fonbeforedragevent
write fonbeforedragevent;
property onafterdragevent: celldrageventty read fonafterdragevent
write fonafterdragevent;
property font;
end;
......@@ -2172,12 +2200,14 @@ type
procedure objectevent(const sender: tobject;
const event: objecteventty); override;
procedure doasyncevent(var atag: integer) override;
procedure loaded; override;
procedure doexit; override;
procedure doenter; override;
procedure doactivate; override;
procedure dodeactivate; override;
procedure activechanged; override;
procedure getautopaintsize(var asize: sizety) override;
procedure mouseevent(var info: mouseeventinfoty); override;
procedure clientmouseevent(var info: mouseeventinfoty); override;
procedure domousewheelevent(var info: mousewheeleventinfoty); override;
......@@ -5815,18 +5845,6 @@ begin
ftotsize:= ftotsize + int2;
end
else begin //datacols
{
for int1:= count - 1 downto count - foppositecount do begin
with tgridprop(fitems[int1]) do begin
fend:= int3;
dec(int3,step);
inc(int2,step);
fstart:= int3;
end;
end;
ftotsize:= int2;
int2:= 0;
}
with tdatacols(self) do begin
int2:= 0;
fscrollsize:= 0;
......@@ -6997,6 +7015,32 @@ begin
end;
end;
procedure tdrawcol.beforedragevent(var ainfo: draginfoty; const arow: integer;
var processed: boolean);
begin
if not processed and assigned(fonbeforedragevent) then begin
fcellinfo.cell.row:= arow;
fonbeforedragevent(fcellinfo,ainfo,tcelldragobject(ainfo.dragobjectpo^),
ainfo.accept,processed);
end;
if not processed then begin
inherited;
end;
end;
procedure tdrawcol.afterdragevent(var ainfo: draginfoty; const arow: integer;
var processed: boolean);
begin
if not processed and assigned(fonafterdragevent) then begin
fcellinfo.cell.row:= arow;
fonafterdragevent(fcellinfo,ainfo,tcelldragobject(ainfo.dragobjectpo^),
ainfo.accept,processed);
end;
if not processed then begin
inherited;
end;
end;
{ tstringcoldatalist }
constructor tstringcoldatalist.create(const agrid: tcustomgrid);
......@@ -13895,6 +13939,37 @@ begin
end;
end;
procedure tcustomgrid.doasyncevent(var atag: integer);
begin
if atag = gridautosizetag then begin
exclude(fstate1,gs1_autosizepending);
checkautosize();
designchanged;
end
else begin
inherited;
end;
end;
procedure tcustomgrid.getautopaintsize(var asize: sizety);
begin
if foptionswidget1 * [ow1_autowidth,ow1_autoheight] = [] then begin
inherited;
end
else begin
if fstate*[gs_updatelocked,gs_layoutupdating] <> [] then begin
if not (gs1_autosizepending in fstate1) then begin
include(fstate1,gs1_autosizepending);
asyncevent(gridautosizetag,[peo_local]);
end;
end
else begin
asize:= calcminscrollsize();
end;
inherited;
end;
end;
procedure tcustomgrid.getpickobjects(const sender: tobjectpicker;
var objects: integerarty);
var
......@@ -19336,5 +19411,23 @@ begin
optionsgrid:= optionsgrid + newcomponentoptionsgridadd;
end;
{ tcelldragobject }
constructor tcelldragobject.create(const draginfo: draginfoty;
const cellinfo: cellinfoty);
begin
fgrid:= cellinfo.grid;
fcell:= cellinfo.cell;
inherited create(cellinfo.grid,draginfo.dragobjectpo^,draginfo.pickpos);
end;
constructor tcelldragobject.create(const agrid: tcustomgrid;
var ainstance: tdragobject; const apos: pointty);
begin
fgrid:= agrid;
fcell:= agrid.cellatpos(apos);
inherited create(agrid,ainstance,apos);
end;
end.
......@@ -60,7 +60,8 @@ type
public
constructor create(aowner: tcomponent); override;
destructor destroy; override;
property options: objectpickeroptionsty read getoptions write setoptions;
property options: objectpickeroptionsty read getoptions
write setoptions default [];
property ongetcursorshape: getcursorshapeeventty read fongetcursorshape
write fongetcursorshape;
property ongetpickobjects: getpickobjectseventty read fongetpickobjects
......
......@@ -115,7 +115,7 @@ type
procedure fontcanvaschanged; override;
procedure visiblechanged; override;
procedure updatetextflags;
function updatetextflags(const aflags: textflagsty): textflagsty;
procedure updaterects; override;
procedure updatehotkeys() override;
procedure dominsize(var asize: sizety);
......@@ -2684,7 +2684,7 @@ begin
end;
if finfo.text.text <> '' then begin
flagsbefore:= finfo.flags;
updatetextflags();
finfo.flags:= updatetextflags(finfo.flags);
drawtext(canvas,finfo);
finfo.flags:= flagsbefore;
end;
......@@ -2758,10 +2758,12 @@ begin
end;
end;
procedure tcustomcaptionframe.updatetextflags;
function tcustomcaptionframe.updatetextflags(
const aflags: textflagsty): textflagsty;
begin
result:= finfo.flags;
if (fs_disabled in fstate) and not (cfo_captionnogray in foptions) then begin
include(finfo.flags,tf_grayed);
include(result,tf_grayed);
end;
end;
......@@ -2772,19 +2774,20 @@ var
rect1,rect2: rectty;
bo1,bo2: boolean;
widget1: twidget1;
// flagsbefore: textflagsty;
flagsbefore: textflagsty;
begin
inherited;
fra1:= fouterframe;
fstate:= fstate - [fs_cancaptionsyncx,fs_cancaptionsyncy];
if finfo.text.text <> '' then begin
// flagsbefore:= finfo.flags;
updatetextflags();
flagsbefore:= finfo.flags;
finfo.flags:= updatetextflags(finfo.flags);
canvas:= icaptionframe(fintf).getcanvas;
canvas.font:= getfont;
finfo.dest.size:= icaptionframe(fintf).getwidgetrect.size;
rect1:= deflaterect(makerect(nullpoint,finfo.dest.size),fouterframe);
textrect(canvas,finfo);
finfo.flags:= flagsbefore;
// finfo.flags:= flagsbefore-[tf_xcentered,tf_ycentered,tf_right,tf_bottom];
finfo.dest:= finfo.res;
bo1:= cfo_captiondistouter in foptions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment