编辑器

标签-搜索结果-字体放大功能
This commit is contained in:
JianjunLiu 2023-04-19 10:12:38 +08:00
parent 1c0fe31233
commit 8171137047
3 changed files with 124 additions and 32 deletions

View File

@ -627,6 +627,14 @@ type TEditerAuxiliary=class(TPage) //
//FFileFindeItem := CreateApageItem();
OnSelChanged := thisfunction(OnSelChangedCall);
CloseBtn := true;
onnotification := function(o,e)begin
ms := e.message;
if ifarray(ms) and ms[0] ="font" then
begin
font := ms[1];
InValidateRect(nil,false);
end
end
end
function WMNCLBUTTONDOWN(o,e):WM_NCLBUTTONDOWN;override;
begin
@ -1725,7 +1733,7 @@ type TEditer=class(TCustomcontrol) //
FInfoShowWnd := new TEditerAuxiliary(self);
FPageEditer := new TPageEditer(self);
FPageEditer.onscrollfont := function(o,ft)begin
self.Notification(self,array("font",ft));
FinCodemap.FTree.font := ft;
FinCodemap.FTree.ItemHeight := ft["height"]+6;
end
@ -5653,6 +5661,13 @@ type TFindListWnd=class(TListBox) //
function Create(AOwner);
begin
inherited;
onnotification := function(o,e)begin
ms := e.message;
if ifarray(ms) and ms[0] ="font" then
begin
font := ms[1];
end
end
end
function CheckListItem(s);override;
begin

View File

@ -799,6 +799,19 @@ type TTslDebuga=class(TCustomControl)
begin
return 1;
end
onnotification := function(o,e)begin
if not (FStackList and FVaraiblesList) then return ;
ms := e.message;
if ifarray(ms) and ms[0] ="font" then
begin
ft := ms[1];
FStackList.font := ft;
FStackList.ItemHeight := ft["height"]+6;
FVaraiblesList.font := ft;
FVaraiblesList.ItemHeight := ft["height"]+6;
//font := ms[1];
end
end
end
function addbreak(item,idx,n); //添加断点
begin

View File

@ -2249,17 +2249,8 @@ type tsgtkapi = class(tgtkapis)
begin
global g_open_file_flag;
///////////////////////////////////////////////
GTK_RESPONSE_HELP := -11;
GTK_RESPONSE_APPLY := -10;
GTK_RESPONSE_NO := -9;
GTK_RESPONSE_YES := -8;
GTK_RESPONSE_CLOSE := -7;
GTK_RESPONSE_CANCEL := -6;
GTK_RESPONSE_OK := -5;
GTK_RESPONSE_DELETE_EVENT := -4;
GTK_RESPONSE_ACCEPT := -3;
GTK_RESPONSE_REJECT := -2;
GTK_RESPONSE_NONE := -1;
/////////////////////////////////////////
r := false;
obj := new TtagOFNA_(LPOPENFILENAMEA);
@ -2483,24 +2474,15 @@ type tsgtkapi = class(tgtkapis)
begin
///////////////////////////////////////////////
GTK_RESPONSE_HELP := -11;
GTK_RESPONSE_APPLY := -10;
GTK_RESPONSE_NO := -9;
GTK_RESPONSE_YES := -8;
GTK_RESPONSE_CLOSE := -7;
GTK_RESPONSE_CANCEL := -6;
GTK_RESPONSE_OK := -5;
GTK_RESPONSE_DELETE_EVENT := -4;
GTK_RESPONSE_ACCEPT := -3;
GTK_RESPONSE_REJECT := -2;
GTK_RESPONSE_NONE := -1;
/////////////////////////////////////////
obj := new TBrowseinfoA_(LPITEMIDLIST);
wd := obj._getvalue_("hwndowner");
wd := wd?:nil;
if wd and not(gtk_widget_is_toplevel(wd)) then wd := gtk_widget_get_toplevel(wd); //top level
r := 0;
cdlg := gtk_file_chooser_dialog_new("folder selector",wd,3,"open",GTK_RESPONSE_ACCEPT,"cancel",GTK_RESPONSE_CANCEL,nil);
cdlg := gtk_file_chooser_dialog_new("folder selector",wd,2,"open",GTK_RESPONSE_ACCEPT,"cancel",GTK_RESPONSE_CANCEL,0);
dir := obj._getvalue_("pidlroot");
if dir then //默认位置
begin
@ -6401,8 +6383,7 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object)
w := makelong(_const.SB_THUMBTRACK,0);
CallTslVclProc(_const.WM_VSCROLL,w,0,1);
end
static fstaticchanged;
function GtkEventDispatch(a,mn,c,d);override;
{function GtkEventDispatch_(a,mn,c,d);override; //原有的消息处理
begin
//消息分发
if mn="scroll-event" then
@ -6412,7 +6393,7 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object)
nt := now();
if (nt-(1/24/3600/100))<FScrollT then
begin
return true;
//return true;
end
ed := new _GdkEventScroll(c);
dr := ed.direction;
@ -6440,9 +6421,7 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object)
rxy := r[lenr][1];
end
if ri and rxy then
begin
begin
//if hasMessageFromGtkMessageQueue(-1,_const.LM_MOUSEWHEEL) then return true; //20230417暂时屏蔽
if hasMessageFromGtkMessageQueue(-1,_const.WM_SIZE) then return true;
//if hasMessageFromGtkMessageQueue(-1,_const.WM_MOUSEMOVE) then return true;
@ -6479,6 +6458,97 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object)
end
return inherited;
end }
private
fscrollinfos;
ftimerobj;
Fscrolltimedo;
FStatscrollTime;
public
function scrolltimedo(ptr:pointer):integer;
begin
if ifnil(FStatscrollTime) then return 1; //没有滚动消息
//obj := new ttmstruct(ptr);
//obj._setvalue_(0,0);
t := now();
if (t-FStatscrollTime)<(1/24/3600/100) then return 1; //时间间隔不够10毫秒
FStatscrollTime := nil; //执行了
if fscrollinfos then
begin
WHEEL_DELTA := 120;
ctl := 0;
global g_gtk_buttontable,g_gtk_keytable;
if ifarray(g_gtk_buttontable) then
begin
ctl .|= g_gtk_buttontable[0];
ctl .|= g_gtk_buttontable[1];
end
if ifarray(g_gtk_keytable) then
begin
if g_gtk_keytable[0x10] then ctl .|= _const.MK_Shift;
if g_gtk_keytable[0x11] then ctl .|= _const.MK_Control;
end
len := length(fscrollinfos)-1;
xy := fscrollinfos[len,2];
h := fscrollinfos[len,0];
dr := sum(fscrollinfos[:,1]);
if dr=0 then return 1;
fscrollinfos := array();
dr := makelong(ctl,dr);
AddMessageToGtkMessageQueue(h,_const.LM_MOUSEWHEEL,dr,xy,1);
end
return 1;
end
function GtkEventDispatch(a,mn,c,d);override;
begin
//消息分发
if mn="scroll-event" then
begin
h := a.handle;
ed := new _GdkEventScroll(c);
dr := ed.direction;
if dr<>0 and dr<>1 then return ;
x := ed.x_root;
y := ed.y_root;
r := array();
_wapi.GetTopWidgetList(h,x,y,r);
lenr := length(r)-1;
for i := lenr downto 0 do
begin
ri := r[i][0];
rxy := r[i][1];
fv := _wapi.g_object_get_data(ri,"gtk_window_vscroll_bar");
if fv and _wapi.gtk_widget_is_visible(fv) then
begin
ifdowheel := true;
break;
end
end
if not ifdowheel then
begin
ri := r[lenr][0];
rxy := r[lenr][1];
end
if ri and rxy then
begin
if not ftimerobj then
begin
fscrollinfos := array();
Fscrolltimedo := makeinstance(thisfunction(scrolltimedo));
ftimerobj := new ttmstruct(nil);
rt := _wapi.g_timeout_add(8,Fscrolltimedo,ftimerobj._getptr_() );
ftimerobj._setvalue_(0,rt);
end
FStatscrollTime := now(); //当前时间
xy := makelong(rxy[0],rxy[1]);
WHEEL_DELTA := 120;
dr := (dr=1)?(-WHEEL_DELTA):(WHEEL_DELTA);
fscrollinfos[length(fscrollinfos)] := array(ri,dr,xy);
return true;
end
end
return inherited;
end
function Destroy();override;
begin
@ -6803,12 +6873,6 @@ type tGtkMessageQueue=class //
begin
Clean();
end
///////////////´¦ÀíÒ»ÏÂ////////////////
if r and r[1]=0x020a then
begin
end
///////////////////////
unlock();
return r;
end