diff --git a/designer/ctl_mgr/resource.tfm/t_compile_config.tfm b/designer/ctl_mgr/resource.tfm/t_compile_config.tfm index ce3b74d..8798751 100644 --- a/designer/ctl_mgr/resource.tfm/t_compile_config.tfm +++ b/designer/ctl_mgr/resource.tfm/t_compile_config.tfm @@ -1,6 +1,6 @@ object ed_script:t_compile_config caption="编译选项设置" - height=631 + height=634 left=618 minmaxbox=false onclose=compile_config_close @@ -282,6 +282,7 @@ object ed_script:t_compile_config end object ck_s_rp:tcheckbtn caption="资源文件保留相对路径" + enabled=false height=25 left=253 top=25 diff --git a/designer/ctl_mgr/t_compile_config.tsf b/designer/ctl_mgr/t_compile_config.tsf index 25f7620..39b3002 100644 --- a/designer/ctl_mgr/t_compile_config.tsf +++ b/designer/ctl_mgr/t_compile_config.tsf @@ -305,6 +305,11 @@ type t_compile_config=class(tdcreateform) begin r+= (ph?relative_path(v):v)+","; end + lr := length(r); + if lr>2 and r[lr]="," and (r[lr-1]<>"\\") then + begin + r := r[1:(lr-1)]; + end return r; end function relative_path(d); diff --git a/funcext/tvclib/ugtkinterface.tsf b/funcext/tvclib/ugtkinterface.tsf index 74717b9..474c60f 100644 --- a/funcext/tvclib/ugtkinterface.tsf +++ b/funcext/tvclib/ugtkinterface.tsf @@ -335,21 +335,21 @@ type tsgtkapi = class(tgtkapis) gtk_widget_set_size_request(h,cx,max(0,cy-pcd)); g_object_set_data(h,"gtk_layout_width",cx); g_object_set_data(h,"gtk_layout_height",cy); - //lbl := g_object_get_data(h,"gtk_layout_lable"); - //if lbl then gtk_widget_set_size_request(lbl,cx-5,cy-5); flg .|=1; end if flg then begin Gtk_TrigMoveSizeEvent(h,x,y,cx,cy,flg); - end - + end end end function IsGtkWidget(h); begin - wt := static gtk_widget_get_type(); - return g_type_check_instance_is_a(h,wt); + if h>0 or h<0 then + begin + wt := static gtk_widget_get_type(); + return g_type_check_instance_is_a(h,wt); + end end function gtk_window_showmodal(w); //shomodal begin @@ -551,10 +551,8 @@ type tsgtkapi = class(tgtkapis) gtk_main_quit(); return c; end - ///////////////////////////////////////// - - ///////////////////////////////////////// - + ///////////////////////////////////////// + ///////////////////////////////////////// Function LoadCursorA2(hd:pointer;n:pointer) begin rn := array(0x7F01:152,0x7F8A:126,0x7F89:24,0x7F88:0,0x7F87:0, @@ -579,8 +577,7 @@ type tsgtkapi = class(tgtkapis) end ///////////////////////空接口 - function GetModuleHandleA(name:pointer)begin return 1; end; - + function GetModuleHandleA(name:pointer)begin return 1; end; function SetClassLongPtrA(HH:pointer;idx:integer;dwNewLong:pointer)begin end; function GetClassLongPtrA(HH:pointer;idx:integer)begin end; //////////////////////////////////////// @@ -589,14 +586,6 @@ type tsgtkapi = class(tgtkapis) //默认处理程序 //echo "call defalt handler\r\n"; end - function GetKeyState(key); - begin - return gtk_GetKeyState(key); - end - function GetAsyncKeyState(key); - begin - return gtk_GetAsyncKeyState(key); - end function GetSysColor(idx:integer):integer; begin if idx = 0x5 then @@ -713,33 +702,20 @@ type tsgtkapi = class(tgtkapis) h := g_object_get_data(hwnd,"gtk_clientwideget"); if h then begin - return gtk_widget_queue_draw(h); if ifarray(rec) and ifnumber(rec[0]) and ifnumber(rec[1]) and ifnumber(rec[2]) and ifnumber(rec[3]) then - begin + begin gtk_widget_queue_draw_area(h,rec[0],rec[1],rec[2]-rec[0],rec[3]-rec[1]); - {echo "\r\nvalidate rect:",hwnd,"====",h,tostn(array(rec[0],rec[1],rec[2]-rec[0],rec[3]-rec[1])); - - r := zeros(4); - hd := gtk_widget_get_window(h); - if hd then - begin - cr := gdk_cairo_create(hd); - echo "rueturna:",gdk_cairo_get_clip_rectangle(cr,r); - echo "\r\ngetset:",tostn(r); - end } end else begin gtk_widget_queue_draw(h); - //echo "\r\nvalidate nil:",hwnd,"====",h; - end + end end end function InvalidateRect2(hwnd :pointer;rec:pointer;f:integer):integer; begin InvalidateRect(hwnd,0,f); - end - + end //////////////////////////////gdi/////////////////////////////////////////// function SelectObject(hdc :pointer;gdiobj:pointer); begin @@ -944,46 +920,6 @@ type tsgtkapi = class(tgtkapis) cairo_stroke(hdc); end return 1; - while idx<=tlen do - begin - if udl then bxp := xp; - ci := GetChar(txt,idx); - {if ci=13 then // \n - begin - idx++; - yp+=ht; - continue; - end else // \r - if ci = 10 then - begin - idx++; - xp := x+xb; - continue; - end } - cairo_move_to(hdc,xp,yp); - if (ci .& 0x80) then - begin - if idx14 then - cairo_show_text(hdc,TslStringToGtk2( txt[idx])); - end - xp+=wid; - idx++; - if udl then - begin - cairo_move_to(hdc,bxp,yp); - cairo_line_to(hdc,xp,yp); - end - //cairo_move_to(hdc,xp,yp); - end - cairo_stroke(hdc); - return 1; end Function DrawTextA(hdc :pointer;txt:string;len:integer;rec:array of integer;fmt:integer):integer; begin @@ -1004,55 +940,55 @@ type tsgtkapi = class(tgtkapis) wd := fto._getvalue_("width"); ht := fto._getvalue_("height"); end - //DT_LEFT := 0; - DT_RIGHT := 0x2; - //DT_TOP := 0; - DT_BOTTOM:= 0x8; - DT_CENTER := 0x1; - DT_VCENTER:= 0x4; - //DT_SINGLELINE:= 0x20; - //DT_TABSTOP:= 0x80; - rw := rec[2]-rec[0]; - nlen := min(len, min(integer(rw/wd),slen)); - sx := rec[0]; - rh := rec[3]-rec[1]; - sy := rec[1]; - if fmt=0 or not(fmt>0 or fmt<0 ) then - begin - - end - if (fmt .& DT_CENTER)=DT_CENTER then //处理 - begin - if nlen = slen then - begin - sx +=(rw-(nlen*wd))/2; - end - - end - if (fmt .& DT_VCENTER)=DT_VCENTER then //处理 - begin - if rh>ht then - begin - sy+=(rh-ht)/2; - end - end - if (fmt .& DT_RIGHT)=DT_RIGHT then //不处理 - begin - if rw>(nlen*wd) then - begin - sx := rec[2]-((nlen*wd)); - end - end - if (fmt .& DT_BOTTOM)=DT_BOTTOM then //不处理 - begin - sy := rec[3]-3-ht; - end + //DT_LEFT := 0; + DT_RIGHT := 0x2; + //DT_TOP := 0; + DT_BOTTOM:= 0x8; + DT_CENTER := 0x1; + DT_VCENTER:= 0x4; + //DT_SINGLELINE:= 0x20; + //DT_TABSTOP:= 0x80; + rw := rec[2]-rec[0]; + nlen := min(len, min(integer(rw/wd),slen)); + sx := rec[0]; + rh := rec[3]-rec[1]; + sy := rec[1]; + if fmt=0 or not(fmt>0 or fmt<0 ) then + begin + + end + if (fmt .& DT_CENTER)=DT_CENTER then //处理 + begin + if nlen = slen then + begin + sx +=(rw-(nlen*wd))/2; + end + + end + if (fmt .& DT_VCENTER)=DT_VCENTER then //处理 + begin + if rh>ht then + begin + sy+=(rh-ht)/2; + end + end + if (fmt .& DT_RIGHT)=DT_RIGHT then //不处理 + begin + if rw>(nlen*wd) then + begin + sx := rec[2]-((nlen*wd)); + end + end + if (fmt .& DT_BOTTOM)=DT_BOTTOM then //不处理 + begin + sy := rec[3]-3-ht; + end r := TextOutA(hdc,sx,sy,txt,nlen); return r; rr := gtk_object_get_data(hdc,"rgn"); if rr then begin - p := new TCRect(gdiobj); + p := new TCRect(rr); rc := p._getdata_(); cairo_reset_clip(hdc); cairo_rectangle(hdc,rc[0],rc[1],rc[2]-rc[0],rc[3]-rc[1]); @@ -1127,8 +1063,7 @@ type tsgtkapi = class(tgtkapis) DeleteDC(hdc); end function SelectClipRgn(hdc :pointer;gdiobj:pointer); - begin - + begin r := SelectObject(hdc,gdiobj); if not(gdiobj) then begin @@ -1422,8 +1357,7 @@ type tsgtkapi = class(tgtkapis) dx := p1["x_r"]-p1["x"]; dy := p1["y_r"]-p1["y"]; p[0]+=dx; - p[1]+=dy; - + p[1]+=dy; end return true; end @@ -1443,8 +1377,6 @@ type tsgtkapi = class(tgtkapis) begin psc := new TPAINTSTRUCT(strc); dc := g_object_get_data(hwd,"paint_dc"); - //h := g_object_get_data(hwd,"paint_height"); - //w := g_object_get_data(hwd,"paint_width"); rec := g_object_get_data(hwd,"paint_rect"); psc._setvalue_("hdc",dc); psc._setvalue_("rcpaint",array(rec[0],rec[1],rec[0]+rec[2],rec[1]+rec[3])); //{array(0,0,w,h)} @@ -1505,15 +1437,13 @@ type tsgtkapi = class(tgtkapis) wd := fto._getvalue_("width"); end end - psizl[0] := wd*length(lpString); - psizl[1] := ht; - return 1; + psizl[0] := wd*length(lpString); + psizl[1] := ht; + return 1; end function GetCharWidthA(hdc:pointer;iFirst:integer;iLast:integer;var lpBuffer:array of integer):integer; - begin - - + begin end Function Rectangle(dc :pointer;l:integer;t:integer;r:integer;b:integer):integer; begin @@ -2183,8 +2113,10 @@ type tsgtkapi = class(tgtkapis) Function SetCursor(hd:pointer):pointer; begin global g_show_cursor_window; - if g_show_cursor_window and hd<>0 then + if g_show_cursor_window and (hd>0 or hd<0) then + begin gdk_window_set_cursor(g_show_cursor_window,hd); + end end function drawbitmaptodc(bm,hdc,x,y,rc,flag,thdc); begin @@ -2817,7 +2749,8 @@ type tsgtkapi = class(tgtkapis) //caret 插入符号 处理 function drawcaret(h,xy,f); begin - ct := g_object_get_data(h,"gtk_window_caret"); + global g_caret_object; + ct := g_caret_object;//g_object_get_data(h,"gtk_window_caret"); if f=1 then //清除 begin if g_object_get_data(ct,"isshow") then return ; @@ -2840,41 +2773,6 @@ type tsgtkapi = class(tgtkapis) g_object_set_data(ct,"isshow",true); gtk_widget_show(ct); end - - return ; - //////////////////////////// - - //获得窗口 - hwcr := g_object_get_data(h,"gtk_clientwideget"); - hcr := gdk_cairo_create(gtk_widget_get_window(hwcr)); - //echo "\r\n>>get:",cairo_get_operator(hcr); - //cairo_set_operator(hcr,11); - //echo ">>2get:",cairo_get_operator(hcr); - //cairo_set_source_rgb(hcr,0,0,0); - if f=-1 then - begin - if g_object_get_data(ct,"isshow") then - begin - g_object_set_data(ct,"isshow",0); - cairo_set_source_rgb(hcr,0,0,0); - end else - begin - g_object_set_data(ct,"isshow",true); - cairo_set_source_rgb(hcr,1,1,1); - end - end else - if f = 1 then - begin - g_object_set_data(ct,"isshow",true); - cairo_set_source_rgb(hcr,1,1,1); - end - cairo_set_line_width(hcr,max(2, g_object_get_data(ct,"width_c"))); - cairo_move_to(hcr, xy[0], xy[1]); - cairo_line_to(hcr, xy[0], xy[1]+g_object_get_data(ct,"heigt_c")); - cairo_stroke(hcr); - //cairo_rectangle(hcr,xy[0],xy[1],5,20); - //cairo_fill(hcr); - cairo_destroy(hcr); //? end private g_gtk_caret_cache_timer; @@ -2890,27 +2788,27 @@ type tsgtkapi = class(tgtkapis) end public function CreateCaret(hWnd :pointer;hBitmap:pointer;nWidth:integer;nHeight:integer):integer; - begin - if not(hwnd>0 or hwnd<0) then return 0; + begin + global g_Caret_Blink_Time,g_caret_object; + if not(hwnd>0 or hwnd<0) then return 0; + if gtk_widget_is_toplevel(hwnd) then pw := hwnd; + else pw := gtk_widget_get_toplevel(hwnd); if not g_gtk_caret_cache_timer then begin Fscrolltimedo := makeinstance(thisfunction(docarettime)); g_gtk_caret_cache_timer:= new ttmstruct(nil); - rt := g_timeout_add(800,Fscrolltimedo,g_gtk_caret_cache_timer._getptr_() ); + rt := g_timeout_add(g_Caret_Blink_Time,Fscrolltimedo,g_gtk_caret_cache_timer._getptr_() ); g_gtk_caret_cache_timer._setvalue_(0,rt); end - h := g_object_get_data(hwnd,"gtk_window_caret"); //获得caret + h := g_caret_object; if not h then begin - h := gtk_event_box_new(); + h := gtk_window_new(1); c := new _GdkColor(nil); c.SetRgb(0,0,0); - gtk_widget_modify_bg(h,0,c._getptr_()); - gtk_widget_hide(h); - lot := g_object_get_data(hWnd,"gtk_layout"); - //gtk_layout_move(lot,h,x,y); - gtk_layout_put(lot,h,0,0); - g_object_set_data(hwnd,"gtk_window_caret",h); + gtk_widget_modify_bg(h,0,c._getptr_()); + gtk_window_move(h,0,0); + g_caret_object := h; end if nWidth>=0 and nHeight>=0 then begin @@ -2918,40 +2816,42 @@ type tsgtkapi = class(tgtkapis) g_object_set_data(h,"heigt_c",nHeight); gtk_widget_set_size_request(h,nWidth,nHeight); end + gtk_window_set_transient_for(h,pw); return h; - end + end function DestroyCaret():integer; begin - global g_current_get_focus_widget; + global g_current_get_focus_widget,g_caret_object; hwnd := g_current_get_focus_widget; if not(hwnd>0 or hwnd<0) then return ; if not IsGtkWidget(hwnd) then return ; g_object_set_data(hwnd,"caretshow",0); - ct := g_object_get_data(hwnd,"gtk_window_caret"); - gtk_widget_hide(ct); + //ct := g_object_get_data(hwnd,"gtk_window_caret"); + gtk_widget_hide(g_caret_object); return ; // 获得focus end function SetCaretPos(x:integer;y:integer):integer; begin - global g_current_get_focus_widget; + global g_current_get_focus_widget,g_caret_object; hwnd := g_current_get_focus_widget; if IsGtkWidget(hwnd) then begin - crt := g_object_get_data( hwnd,"gtk_window_caret"); + crt := g_caret_object; GetCaretPos(xy); if crt then //处理此处 begin gtk_object_set_data(hwnd,"caret_x_pos",x); gtk_object_set_data(hwnd,"caret_y_pos",y); - lot := g_object_get_data(hwnd,"gtk_layout"); - gtk_layout_move(lot,crt,x,y); + p := array(x,y); + ClientToScreen(hwnd,p); + gtk_window_move(crt,p[0],p[1]); end if xy[0]<>x then drawcaret(hwnd,xy,1); end return ; - end + end function GetCaretPos(lp:array of integer):integer; begin global g_current_get_focus_widget; @@ -2971,7 +2871,8 @@ type tsgtkapi = class(tgtkapis) // 获得focus widget if not(hwnd>0 or hwnd<0) then return ; if not IsGtkWidget(hwnd) then return ; - ct := g_object_get_data(hwnd,"gtk_window_caret"); + global g_caret_object; + ct := g_caret_object;//g_object_get_data(hwnd,"gtk_window_caret"); g_object_set_data(hwnd,"caretshow",0); if ct then gtk_widget_hide(ct); return ; @@ -3347,7 +3248,7 @@ type tgtkapis = class() //gtk begin return AddMessageToGtkMessageQueue(FHandle,msg,wparam,lparam,d); end - function gtk_GetKeyState(key); //按键状态 + function GetKeyState(key); //按键状态 begin global g_gtk_keytable; if g_gtk_keytable then @@ -3359,7 +3260,7 @@ type tgtkapis = class() //gtk end end ; end - function gtk_GetAsyncKeyState(key);//鼠标按键状态 + function GetAsyncKeyState(key);//鼠标按键状态 begin global g_gtk_buttontable; if g_gtk_buttontable then @@ -3623,27 +3524,13 @@ type tgtkapis = class() //gtk begin if fileexists("","/usr/bin/zenity") then begin - for i := length(p) downto 1 do - begin - if p[i]="/" then - begin - tsl_gtk_execsystem(format('zenity --file-selection --filename="%s" &',p[1:i])); - break; - end - end - return ;// + tsl_gtk_execsystem(format('zenity --file-selection --filename="%s" &',p)); + return 1;// end if fileexists("","/usr/bin/caja") then begin - for i := length(p) downto 1 do - begin - if p[i]="/" then - begin - tsl_gtk_execsystem(format('caja "%s" &',p[1:i])); - break; - end - end - return ;// + tsl_gtk_execsystem(format('caja "%s" &',p)); + return 1; end tsl_gtk_execsystem(format('nautilus "%s" &',p)); return 1; @@ -6795,7 +6682,7 @@ type tgtk_ctl_object = class(_gtkeventtype) end return 0; end - static fwindow_cursor; + fwindow_cursor; function CallTslVclProc(msg,w,l,P);virtual; //调用到win消息处理 begin CM_CURSORCHANGED := _const.CM_CURSORCHANGED; @@ -6825,7 +6712,6 @@ type tgtk_ctl_object = class(_gtkeventtype) clearMessageFromGtkMessageQueue(FHandle,CM_CURSORCHANGED); case r of 10,11:begin - //_wapi.gdk_window_set_cursor(wd,FsysCursors[1]) ; g_show_cursor_window := 0; if fwindow_cursor <> FsysCursors[1] then begin @@ -6834,8 +6720,7 @@ type tgtk_ctl_object = class(_gtkeventtype) end end 12,15:begin - //_wapi.gdk_window_set_cursor(wd,FsysCursors[2]) ; - //g_show_cursor_window := 0; + g_show_cursor_window := 0; if fwindow_cursor <> FsysCursors[2] then begin fwindow_cursor := FsysCursors[2]; @@ -6843,12 +6728,11 @@ type tgtk_ctl_object = class(_gtkeventtype) end end 1:begin - //_wapi.gdk_window_set_cursor(wd,FsysCursors[0]) ; - //AddMessageToGtkMessageQueue(FHandle,CM_CURSORCHANGED,0,0); if fwindow_cursor <> FsysCursors[0] then begin - fwindow_cursor := FsysCursors[0]; - AddMessageToGtkMessageQueue(FHandle,CM_CURSORCHANGED,wd,FsysCursors[0]); + fwindow_cursor := FsysCursors[0]; + //AddMessageToGtkMessageQueue(FHandle,CM_CURSORCHANGED,wd,FsysCursors[0]); + AddMessageToGtkMessageQueue(FHandle,_const.WM_SETCURSOR,wd,FsysCursors[0]); end end else @@ -6862,7 +6746,6 @@ type tgtk_ctl_object = class(_gtkeventtype) FHitwidgetposition := ht; if ht=10 or ht=11 then begin - //return _wapi.gdk_window_set_cursor(wd,FsysCursors[1]) ; g_show_cursor_window := 0; if fwindow_cursor <> FsysCursors[1] then begin @@ -6873,7 +6756,6 @@ type tgtk_ctl_object = class(_gtkeventtype) if ht=12 or ht=15 then begin g_show_cursor_window := 0; - //return _wapi.gdk_window_set_cursor(wd,FsysCursors[2]) ; if fwindow_cursor <> FsysCursors[2] then begin fwindow_cursor := FsysCursors[2]; @@ -6881,12 +6763,10 @@ type tgtk_ctl_object = class(_gtkeventtype) end return r; end end - //_wapi.gdk_window_set_cursor(wd,FsysCursors[0]) ; - //return AddMessageToGtkMessageQueue(FHandle,CM_CURSORCHANGED,0,0); if fwindow_cursor<>FsysCursors[0] then begin fwindow_cursor := FsysCursors[0]; - return AddMessageToGtkMessageQueue(FHandle,CM_CURSORCHANGED,wd,FsysCursors[0]); + return AddMessageToGtkMessageQueue(FHandle,_const.WM_SETCURSOR,wd,FsysCursors[0]); end return r; end end ; @@ -6960,6 +6840,7 @@ type tgtk_ctl_object = class(_gtkeventtype) end function imitate_event_size();virtual; //模拟移动 begin + if _wapi.gtk_object_get_data(Handle,"gtk_wnd_hs_caption") then return false; return true; end function GSWINDOWSTATEEVENT(a,b,c,d);virtual; //状态改变 @@ -7053,12 +6934,7 @@ type tgtk_ctl_object = class(_gtkeventtype) end ; return CanignoreBtnpress(); end - psi := makelong(integer(e.x),integer(e.y)); - //r := array(); - //_wapi.GetTopWidgetList(a.handle,e.x_root,e.y_root,r); - //rl := length(r)-1; - //if r[rl,0]<>a.handle then return false; - + psi := makelong(integer(e.x),integer(e.y)); case e.button of 1: begin @@ -7113,6 +6989,8 @@ type tgtk_ctl_object = class(_gtkeventtype) function GSBUTTONRELEASEEVENT(a,b,c,d);virtual; begin global g_gtk_buttontable, g_gtk_keytable,g_c_btn_release_event; + FHitwidgetposition := 0; + Fsyscommand0x12info := nil; e := new _GdkEventButton(c); ev := new _GdkEventButton(nil); ev.CopyFromString(e.CopyToString()); @@ -7533,11 +7411,6 @@ type tgtk_ctl_object = class(_gtkeventtype) e := new _GdkEventAny(c); if imitate_event_size() then begin - global g_gtk_scroll_lock; - if g_gtk_scroll_lock then - begin - return true; - end if FHitwidgetposition in array(110,111,112,115) then begin if mn="event" then @@ -7549,7 +7422,7 @@ type tgtk_ctl_object = class(_gtkeventtype) cxy := array(0,0); _wapi.GetCursorPos(cxy); dx := cxy[0]-ogps[0]; - dy := cxy[1]-ogps[1]; + dy := cxy[1]-ogps[1]; case FHitwidgetposition of //0 修改为 -1 110: begin @@ -7609,7 +7482,10 @@ type tgtk_ctl_object = class(_gtkeventtype) end end end - case mn of + case mn of + GS_ENTER_NOTIFY_EVENT: + begin + end GS_DESTROY: begin Fsyscommand0x12 := 0; @@ -8137,21 +8013,14 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object) hd := a.handle; r := zeros(4); _wapi.gtk_widget_get_allocation(hd,r); - cr := _wapi.gdk_cairo_create(_wapi.gtk_widget_get_window(hd)); - rec := zeros(4); - _wapi.gdk_cairo_get_clip_rectangle(cr,rec); - //echo ">>>1111",tostn(rec); - //echo ">>>extents:"; + //cr := _wapi.gdk_cairo_create(_wapi.gtk_widget_get_window(hd)); + cr :=c;//rec := r; + rec := zeros(4); _wapi.gdk_cairo_get_clip_rectangle(cr,rec); //_wapi.cairo_clip_extents(cr,x,y,w,h); hwd := handle; - //echo "paintrect:",hd,tostn(rec); _wapi.g_object_set_data(hwd,"paint_dc",cr); _wapi.g_object_set_data(hwd,"paint_rect",rec); - //_wapi.g_object_set_data(hwd,"paint_height",r[3]); - //_wapi.g_object_set_data(hwd,"paint_width",r[2]); - //mtic; - CallTslVclProc(_const.WM_PAINT,0,0); //绘制 - + CallTslVclProc(_const.WM_PAINT,0,0); //绘制 if not(self(true) is class(tgtk_ctl_window_PoPup)) then begin if (r[2]<=(rec[0]+rec[2])) or (r[3]<=(rec[1]+rec[3])) then @@ -8174,9 +8043,8 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object) CallTslVclProc(_const.WM_NCPAINT,0,cr); //绘制 end end - _wapi.cairo_destroy(cr); + //_wapi.cairo_destroy(cr); _wapi.gtk_object_set_data(cr); - //echo "\r\ntime:",datetimetostr(now()),"===timeuses:",mtoc,"===",hd; end; function CreateWnd(dwExStyle,lpClassName,lpWindowName,dwStyle,x,y,nwidth,nheight,hwndparent,hmenu,hinstance,lpParam);override; begin @@ -8630,8 +8498,7 @@ type tgtk_ctl_object_client = class(tgtk_ctl_object) function create(h); begin inherited; - end - + end end type tgtk_ctl_window_PoPup = class(tgtk_ctl_scroll_window) function Create(h);override; @@ -8650,11 +8517,6 @@ type tgtk_ctl_window_PoPup = class(tgtk_ctl_scroll_window) end inherited; end - function imitate_event_size();override; - begin - if _wapi.gtk_object_get_data(Handle,"gtk_wnd_hs_caption") then return false; - return true; - end function later_set_size(id:pointer):integer;cdecl; begin _wapi.g_object_set_data(id,"size_last_set",0); @@ -8856,8 +8718,14 @@ type tgtk_ctl_window_PoPup = class(tgtk_ctl_scroll_window) FClientObject.connect(GS_BUTTON_PRESS_EVENT,thisfunction(cleinteventpress)); FClientObject.connect(GS_BUTTON_RELEASE_EVENT,thisfunction(cleinteventrelease)); FClientObject.connect(GS_MOTION_NOTIFY_EVENT,thisfunction(cleinteventmove)); + connect(GS_EVENT,thisfunction(nonevent)); + FClientObject.connect(GS_EVENT,thisfunction(mygsevent)); end return r; + end + function nonevent(); + begin + end function GSBUTTONRELEASEEVENT(a,b,c,d);override; begin @@ -8886,6 +8754,10 @@ type tgtk_ctl_window_PoPup = class(tgtk_ctl_scroll_window) begin return inherited GSMOTIONNOTIFYEVENT(self,b,c,d); end + function mygsevent(a,b,c,d); + begin + return GtkEventDispatchA(self,b,c,d); + end end type tgtk_wnd_info = class() @@ -9612,7 +9484,7 @@ begin begin G_E_ID_Name_2[v] := i; end - g_Caret_Blink_Time := 800; + g_Caret_Blink_Time := 600; g_gtk_dragxy := array(0,0); g_gtk_font_get_size := array(); gtk_init_check(nil,nil); @@ -9623,7 +9495,10 @@ begin g_gtk_shadow_heigt := 89; g_gtk_buttontable := array(0,0); g_gtk_keytable := array(0x10:0,0x11:0,0x12:0); - g_gtk_call_handler_manager := new tinstancemanager(); + g_gtk_call_handler_manager := new tinstancemanager(); + //////////////////初始化kyemap///////////////////////////////////////////// + if getglobalcache("~gtk~init",gc) then return ;//echo gc ; + setglobalcache("~gtk~init","\r\ngtk init ok"); kmp := keymap_get_default(); if not kmp then return 0; signal_connect_data(kmp,"state-changed",g_gtk_call_handler_manager.get(thisfunction(tsl_gtk_keymp_state)),0,0); @@ -9685,6 +9560,14 @@ begin end end ////////////////////////new function////////////////////////////////////////////// +function c_g_e_enter_notify_event(w:pointer;dt:pointer;u_d:pointer):integer; +begin + return _gtkeventcall_(w,u_d,dt); +end +function c_g_e_leave_notify_event(w:pointer;dt:pointer;u_d:pointer):integer; //leave-notify-event +begin + return _gtkeventcall_(w,u_d,dt); +end function c_g_e_drag_begin(w:pointer;dt:pointer;u_d:pointer):integer; // begin return _gtkeventcall_(w,u_d,dt); diff --git a/funcext/tvclib/utslmemo.tsf b/funcext/tvclib/utslmemo.tsf index 205b134..369a39a 100644 --- a/funcext/tvclib/utslmemo.tsf +++ b/funcext/tvclib/utslmemo.tsf @@ -1521,8 +1521,8 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) // function MoveCaretAndSelection(p1,p2,sel);//移动选择 begin if not(ifarray(p2)and ifarray(p1)and p2[0]>= 1 and p2[1]>= 1)then return; - SetCaretXY(p2); IncPaintLock(); + SetCaretXY(p2); if Sel then begin if not SelAvail then fBlockBegin := p1; diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index 28506b7..8d3052a 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -2461,7 +2461,7 @@ type tinstancemanager = class() @param(f)(handler) tsl函数对象 %% @return(pointer) c函数回调 %% **} - id := integer(f); + id := inttostr(int64(f)); r := fhandles[id]; if r then return r; r := makeinstance(f); @@ -2478,7 +2478,7 @@ type tinstancemanager = class() @param(f)(handler) tsl函数对象 %% @return(bool) 是否成功 %% **} - id := integer(f); + id := inttostr(int64(f)); h := fhandles[id]; if h then begin diff --git a/funcext/tvclib/utslvclbase.tsf b/funcext/tvclib/utslvclbase.tsf index 5038089..0bef6b9 100644 --- a/funcext/tvclib/utslvclbase.tsf +++ b/funcext/tvclib/utslvclbase.tsf @@ -186,6 +186,7 @@ type TSLUIBASE=class(TSLUICONST) //图 private FReCycleState; static FTSLkeyWords; + static FTSLkeyWordshash; static TSLRCS_NONE; static TSLRCS_BEGIN; static TSLRCS_END; @@ -219,6 +220,11 @@ type TSLUIBASE=class(TSLUICONST) //图 if not G_O_TSWIN32API_ then G_O_TSWIN32API_ := new tswin32api(); _wapi := G_O_TSWIN32API_; FTSLkeyWords := TSL_ReservedKeys2(); + FTSLkeyWordshash := array(); + for i,v in FTSLkeyWords do + begin + FTSLkeyWordshash[v] := true; + end end if not FHAPP then begin @@ -234,7 +240,7 @@ type TSLUIBASE=class(TSLUICONST) //图 @explan(说明) 判断是否为tsl关键字 %% @param(key)(string) **} - return ifstring(key)and ifarray(FTSLkeyWords)and(lowercase(key)in FTSLkeyWords); + return ifstring(key)and ifarray(FTSLkeyWordshash) and( FTSLkeyWordshash[lowercase(key)]); return false; end