mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 11:19:23 +02:00
MG: small bugfixes
git-svn-id: trunk@287 -
This commit is contained in:
parent
fad535a99c
commit
42ba7dce4d
@ -369,6 +369,7 @@ var
|
|||||||
|
|
||||||
constructor TSourceEditor.Create(AOwner : TComponent; AParent : TWinControl);
|
constructor TSourceEditor.Create(AOwner : TComponent; AParent : TWinControl);
|
||||||
Begin
|
Begin
|
||||||
|
writeln('TSourceEditor.Create A ',AOwner.Classname,' ',AParent.Classname);
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FAOwner := AOwner;
|
FAOwner := AOwner;
|
||||||
|
|
||||||
@ -377,14 +378,18 @@ Begin
|
|||||||
FExecutionLine:=-1;
|
FExecutionLine:=-1;
|
||||||
|
|
||||||
FControl := nil;
|
FControl := nil;
|
||||||
|
writeln('TSourceEditor.Create B ');
|
||||||
CreateEditor(AOwner,AParent);
|
CreateEditor(AOwner,AParent);
|
||||||
|
writeln('TSourceEditor.Create END ');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSourceEditor.Destroy;
|
destructor TSourceEditor.Destroy;
|
||||||
begin
|
begin
|
||||||
writeln('TSourceEditor.Destroy ',FEditor.Name);
|
writeln('TSourceEditor.Destroy A ',FEditor.Name);
|
||||||
FEditor.Free;
|
FEditor.Free;
|
||||||
|
writeln('TSourceEditor.Destroy B ');
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
writeln('TSourceEditor.Destroy END ');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------G O T O L I N E -----------------------------}
|
{------------------------------G O T O L I N E -----------------------------}
|
||||||
@ -628,6 +633,7 @@ End;
|
|||||||
procedure TSourceEditor.DoFindAndReplace;
|
procedure TSourceEditor.DoFindAndReplace;
|
||||||
var OldCaretXY:TPoint;
|
var OldCaretXY:TPoint;
|
||||||
AText,ACaption:AnsiString;
|
AText,ACaption:AnsiString;
|
||||||
|
TopLine: integer;
|
||||||
begin
|
begin
|
||||||
OldCaretXY:=EditorComponent.CaretXY;
|
OldCaretXY:=EditorComponent.CaretXY;
|
||||||
EditorComponent.SearchReplace(
|
EditorComponent.SearchReplace(
|
||||||
@ -638,6 +644,10 @@ begin
|
|||||||
ACaption:='Message';
|
ACaption:='Message';
|
||||||
AText:='Search string '''+FindReplaceDlg.FindText+''' not found!';
|
AText:='Search string '''+FindReplaceDlg.FindText+''' not found!';
|
||||||
Application.MessageBox(PChar(AText),PChar(ACaption),MB_OK);
|
Application.MessageBox(PChar(AText),PChar(ACaption),MB_OK);
|
||||||
|
end else begin
|
||||||
|
TopLine := EditorComponent.CaretY - (EditorComponent.LinesInWindow div 2);
|
||||||
|
if TopLine < 1 then TopLine:=1;
|
||||||
|
EditorComponent.TopLine := TopLine;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1836,13 +1846,14 @@ Function TSourceNotebook.NewSe(PageNum : Integer) : TSourceEditor;
|
|||||||
Begin
|
Begin
|
||||||
writeln('TSourceNotebook.NewSe A');
|
writeln('TSourceNotebook.NewSe A');
|
||||||
if CreateNotebook then Pagenum := 0;
|
if CreateNotebook then Pagenum := 0;
|
||||||
|
if Pagenum < 0 then begin
|
||||||
if Pagenum < 0 then begin //add a new page right to the current
|
// add a new page right to the current
|
||||||
Pagenum := Notebook.PageIndex+1;
|
Pagenum := Notebook.PageIndex+1;
|
||||||
Notebook.Pages.Insert(PageNum,FindUniquePageName('',-1));
|
Notebook.Pages.Insert(PageNum,FindUniquePageName('',-1));
|
||||||
end;
|
end;
|
||||||
|
writeln('TSourceNotebook.NewSe B ',Notebook.PageIndex,',',NoteBook.Pages.Count);
|
||||||
Result := TSourceEditor.Create(Self,Notebook.Page[PageNum]);
|
Result := TSourceEditor.Create(Self,Notebook.Page[PageNum]);
|
||||||
writeln('TSourceNotebook.NewSe B');
|
writeln('TSourceNotebook.NewSe C');
|
||||||
FSourceEditorList.Add(Result);
|
FSourceEditorList.Add(Result);
|
||||||
Result.FUnitName:=Notebook.Pages[PageNum];
|
Result.FUnitName:=Notebook.Pages[PageNum];
|
||||||
Result.CodeTemplates:=CodeTemplateModul;
|
Result.CodeTemplates:=CodeTemplateModul;
|
||||||
@ -2019,8 +2030,7 @@ Procedure TSourceNotebook.FindAgainClicked(Sender : TObject);
|
|||||||
var TempEditor:TSourceEditor;
|
var TempEditor:TSourceEditor;
|
||||||
Begin
|
Begin
|
||||||
TempEditor:=GetActiveSe;
|
TempEditor:=GetActiveSe;
|
||||||
if TempEditor <> nil then
|
if TempEditor <> nil then TempEditor.FindAgain;
|
||||||
TempEditor.FindAgain;
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
@ -2132,7 +2142,7 @@ end;
|
|||||||
Procedure TSourceNotebook.CloseFile(PageIndex:integer);
|
Procedure TSourceNotebook.CloseFile(PageIndex:integer);
|
||||||
var TempEditor: TSourceEditor;
|
var TempEditor: TSourceEditor;
|
||||||
Begin
|
Begin
|
||||||
writeln('TSourceNotebook.CloseFile 1 PageIndex=',PageIndex);
|
writeln('TSourceNotebook.CloseFile A PageIndex=',PageIndex);
|
||||||
TempEditor:= FindSourceEditorWithPageIndex(PageIndex);
|
TempEditor:= FindSourceEditorWithPageIndex(PageIndex);
|
||||||
if TempEditor=nil then exit;
|
if TempEditor=nil then exit;
|
||||||
TempEditor.Close;
|
TempEditor.Close;
|
||||||
@ -2140,6 +2150,7 @@ writeln('TSourceNotebook.CloseFile 1 PageIndex=',PageIndex);
|
|||||||
TempEditor.Free;
|
TempEditor.Free;
|
||||||
if Notebook.Pages.Count>1 then begin
|
if Notebook.Pages.Count>1 then begin
|
||||||
Notebook.Pages.Delete(PageIndex);
|
Notebook.Pages.Delete(PageIndex);
|
||||||
|
writeln('TSourceNotebook.CloseFile G PageIndex=',PageIndex);
|
||||||
UpdateStatusBar;
|
UpdateStatusBar;
|
||||||
end else begin
|
end else begin
|
||||||
Notebook.Free;
|
Notebook.Free;
|
||||||
|
@ -108,8 +108,8 @@ type
|
|||||||
}
|
}
|
||||||
TCustomNotebook = class(TCustomControl)
|
TCustomNotebook = class(TCustomControl)
|
||||||
private
|
private
|
||||||
fPageList: TList;
|
fPageList: TList; // TList of TPage
|
||||||
fAccess: TStrings;
|
fAccess: TStrings; // TNBPages
|
||||||
fPageIndex: Integer;
|
fPageIndex: Integer;
|
||||||
fOnPageChanged: TNotifyEvent;
|
fOnPageChanged: TNotifyEvent;
|
||||||
|
|
||||||
@ -332,6 +332,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.11 2001/06/12 18:31:01 lazarus
|
||||||
|
MG: small bugfixes
|
||||||
|
|
||||||
Revision 1.10 2001/04/17 21:39:17 lazarus
|
Revision 1.10 2001/04/17 21:39:17 lazarus
|
||||||
+ added working OnClick support for TCustomRadiogroup, stoppok
|
+ added working OnClick support for TCustomRadiogroup, stoppok
|
||||||
|
|
||||||
|
@ -79,17 +79,21 @@ begin
|
|||||||
if (Index >= 0) and
|
if (Index >= 0) and
|
||||||
(Index < fPageList.Count) then
|
(Index < fPageList.Count) then
|
||||||
begin
|
begin
|
||||||
{ Make sure there are pages to delete }
|
|
||||||
{ If that page is showing, then show the previous page before deleting it }
|
{ If that page is showing, then show the previous page before deleting it }
|
||||||
if (fPageList.Count > 0) and (Index = fNoteBook.PageIndex) then begin
|
if (Index = fNoteBook.PageIndex) then begin
|
||||||
if fNoteBook.PageIndex>0 then
|
if fNoteBook.PageIndex>0 then
|
||||||
|
// switch current page to prior (left) page
|
||||||
fNoteBook.PageIndex := fNoteBook.PageIndex - 1
|
fNoteBook.PageIndex := fNoteBook.PageIndex - 1
|
||||||
|
else if fPageList.Count>1 then
|
||||||
|
// switch to next (right) page
|
||||||
|
fNoteBook.PageIndex := 1
|
||||||
else
|
else
|
||||||
fNoteBook.PageIndex := 1;
|
// deleting last page
|
||||||
|
// TODO: delete contents but not last page
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FNoteBook.HandleAllocated
|
if FNoteBook.HandleAllocated then begin
|
||||||
then begin
|
|
||||||
Msg.Parent := fNotebook;
|
Msg.Parent := fNotebook;
|
||||||
Msg.fCompStyle := fNotebook.fCompStyle;
|
Msg.fCompStyle := fNotebook.fCompStyle;
|
||||||
Msg.Page := Index;
|
Msg.Page := Index;
|
||||||
@ -266,8 +270,7 @@ var
|
|||||||
Msg: TLMNotebookEvent;
|
Msg: TLMNotebookEvent;
|
||||||
begin
|
begin
|
||||||
fPageIndex := Value;
|
fPageIndex := Value;
|
||||||
if HandleAllocated
|
if HandleAllocated then begin
|
||||||
then begin
|
|
||||||
Msg.Parent := Self;
|
Msg.Parent := Self;
|
||||||
Msg.fCompStyle := fCompStyle;
|
Msg.fCompStyle := fCompStyle;
|
||||||
Msg.Page := Value;
|
Msg.Page := Value;
|
||||||
@ -432,6 +435,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.6 2001/06/12 18:31:01 lazarus
|
||||||
|
MG: small bugfixes
|
||||||
|
|
||||||
Revision 1.5 2001/06/04 09:32:17 lazarus
|
Revision 1.5 2001/06/04 09:32:17 lazarus
|
||||||
MG: fixed bugs and cleaned up messages
|
MG: fixed bugs and cleaned up messages
|
||||||
|
|
||||||
|
@ -662,18 +662,18 @@ activate_time : the time at which the activation event occurred.
|
|||||||
|
|
||||||
LM_AddPage :
|
LM_AddPage :
|
||||||
begin
|
begin
|
||||||
Assert(False, Format('Trace: [TgtkObject.IntSendMessage3] %s --> Add NB page: %s', [Sender.ClassName, TLMNotebookEvent(Data^).Child.ClassName]));
|
Assert(False, Format('Trace: [TgtkObject.IntSendMessage3] %s --> Add NB page: %s', [Sender.ClassName, TLMNotebookEvent(Data^).Child.ClassName]));
|
||||||
AddNBPage(TControl(Sender), TLMNotebookEvent(Data^).Child, TLMNotebookEvent(Data^).Page);
|
AddNBPage(TControl(Sender), TLMNotebookEvent(Data^).Child, TLMNotebookEvent(Data^).Page);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
LM_RemovePage :
|
LM_RemovePage :
|
||||||
begin
|
begin
|
||||||
RemoveNBPage(TControl(Sender), TLMNotebookEvent(Data^).Page);
|
RemoveNBPage(TControl(Sender), TLMNotebookEvent(Data^).Page);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
LM_ShowTabs :
|
LM_ShowTabs :
|
||||||
begin
|
begin
|
||||||
gtk_notebook_set_show_tabs(PGtkNotebook(Handle), Boolean(Integer(TLMNotebookEvent(Data^).ShowTabs)));
|
gtk_notebook_set_show_tabs(PGtkNotebook(Handle), Boolean(Integer(TLMNotebookEvent(Data^).ShowTabs)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
LM_SetTabPosition :
|
LM_SetTabPosition :
|
||||||
@ -814,15 +814,18 @@ activate_time : the time at which the activation event occurred.
|
|||||||
|
|
||||||
LM_SETITEMINDEX :
|
LM_SETITEMINDEX :
|
||||||
begin
|
begin
|
||||||
case (Sender as TControl).fCompStyle of
|
case (Sender as TControl).fCompStyle of
|
||||||
csComboBox: gtk_list_select_item(PGTKLIST(PGTKCOMBO(Handle)^.list), Integer(Data));
|
csComboBox: gtk_list_select_item(PGTKLIST(PGTKCOMBO(Handle)^.list), Integer(Data));
|
||||||
csListBox : gtk_list_select_item(PGtkList(GetCoreChildWidget(PGtkWidget(Handle))), Integer(Data));
|
csListBox : gtk_list_select_item(PGtkList(GetCoreChildWidget(PGtkWidget(Handle))), Integer(Data));
|
||||||
csCListBox: gtk_clist_select_row(PGtkCList(GetCoreChildWidget(PGtkWidget(Handle))), Integer(Data), 1); // column
|
csCListBox: gtk_clist_select_row(PGtkCList(GetCoreChildWidget(PGtkWidget(Handle))), Integer(Data), 1); // column
|
||||||
csNotebook: begin
|
csNotebook:
|
||||||
Assert(False, 'Trace:Setting Page to ' + IntToStr(TLMNotebookEvent(Data^).Page));
|
begin
|
||||||
gtk_notebook_set_page(PGtkNotebook(Handle), TLMNotebookEvent(Data^).Page);
|
Assert(False, 'Trace:Setting Page to ' + IntToStr(TLMNotebookEvent(Data^).Page));
|
||||||
end;
|
writeln('LM_SETITEMINDEX A ',HexStr(Cardinal(Handle),8),', ',TLMNotebookEvent(Data^).Page);
|
||||||
end;
|
gtk_notebook_set_page(PGtkNotebook(Handle), TLMNotebookEvent(Data^).Page);
|
||||||
|
writeln('LM_SETITEMINDEX B ',TLMNotebookEvent(Data^).Page);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
LM_GETSELSTART :
|
LM_GETSELSTART :
|
||||||
@ -2272,9 +2275,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
strDispose(pStr);
|
strDispose(pStr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// gtk_object_set_data(PGtkObject(TPage(Child).Handle), 'Owner', pgtkwidget(TWinControl(Parent).handle));
|
// gtk_object_set_data(PGtkObject(TPage(Child).Handle), 'Owner', pgtkwidget(TWinControl(Parent).handle));
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -2283,8 +2284,8 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TgtkObject.RemoveNBPage(Parent: TObject; Index: Integer);
|
procedure TgtkObject.RemoveNBPage(Parent: TObject; Index: Integer);
|
||||||
begin
|
begin
|
||||||
Assert(false, 'Trace:Removing a notebook page');
|
Assert(false, 'Trace:Removing a notebook page');
|
||||||
gtk_notebook_remove_page(PGtkNotebook(TWinControl(Parent).Handle), Index);
|
gtk_notebook_remove_page(PGtkNotebook(TWinControl(Parent).Handle), Index);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -2868,6 +2869,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.48 2001/06/12 18:31:01 lazarus
|
||||||
|
MG: small bugfixes
|
||||||
|
|
||||||
Revision 1.47 2001/06/05 10:32:05 lazarus
|
Revision 1.47 2001/06/05 10:32:05 lazarus
|
||||||
MG: small bugfixes for bitbtn, handles
|
MG: small bugfixes for bitbtn, handles
|
||||||
|
|
||||||
|
@ -3428,7 +3428,7 @@ begin
|
|||||||
PgdkDrawable(pixmapwid^.window),
|
PgdkDrawable(pixmapwid^.window),
|
||||||
XSrc, YSrc, X, Y, SrcWidth, SrcHeight);}
|
XSrc, YSrc, X, Y, SrcWidth, SrcHeight);}
|
||||||
gdk_draw_pixmap(PDeviceContext(DestDC)^.Drawable,
|
gdk_draw_pixmap(PDeviceContext(DestDC)^.Drawable,
|
||||||
PDeviceContext(SrcDC)^.GC, PDeviceContext(SrcDC)^.Drawable,
|
PDeviceContext(DestDC)^.GC, PDeviceContext(SrcDC)^.Drawable,
|
||||||
XSrc, YSrc, X, Y, SrcWidth, SrcHeight);
|
XSrc, YSrc, X, Y, SrcWidth, SrcHeight);
|
||||||
end else begin
|
end else begin
|
||||||
gdk_draw_pixmap(PDeviceContext(DestDC)^.Drawable,
|
gdk_draw_pixmap(PDeviceContext(DestDC)^.Drawable,
|
||||||
@ -3520,8 +3520,8 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.34 2001/06/06 12:30:41 lazarus
|
Revision 1.35 2001/06/12 18:31:01 lazarus
|
||||||
MG: bugfixes
|
MG: small bugfixes
|
||||||
|
|
||||||
Revision 1.33 2001/04/13 13:22:23 lazarus
|
Revision 1.33 2001/04/13 13:22:23 lazarus
|
||||||
|
|
||||||
|
@ -25,17 +25,17 @@
|
|||||||
@lastmod(2000)
|
@lastmod(2000)
|
||||||
}
|
}
|
||||||
unit GTKWinapiWindow;
|
unit GTKWinapiWindow;
|
||||||
{$mode objfpc}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
glib,gdk,gtk;
|
glib,gdk,gtk;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
|
||||||
PGTKAPIWidget = ^TGTKAPIWidget;
|
PGTKAPIWidget = ^TGTKAPIWidget;
|
||||||
TGTKAPIWidget = record
|
TGTKAPIWidget = record
|
||||||
|
// ! the ScrolledWindow must be the first attribute of this record !
|
||||||
ScrolledWindow: TGTKScrolledWindow;
|
ScrolledWindow: TGTKScrolledWindow;
|
||||||
Client: PGTKWidget;
|
Client: PGTKWidget;
|
||||||
end;
|
end;
|
||||||
@ -47,7 +47,8 @@ type
|
|||||||
|
|
||||||
function GTKAPIWidget_GetType : guint;
|
function GTKAPIWidget_GetType : guint;
|
||||||
function GTKAPIWidget_New : PGTKWidget;
|
function GTKAPIWidget_New : PGTKWidget;
|
||||||
procedure GTKAPIWidget_CreateCaret(APIWidget: PGTKAPIWidget; AWidth, AHeight: Integer; ABitmap: PGDKPixmap);
|
procedure GTKAPIWidget_CreateCaret(APIWidget: PGTKAPIWidget;
|
||||||
|
AWidth, AHeight: Integer; ABitmap: PGDKPixmap);
|
||||||
procedure GTKAPIWidget_HideCaret(APIWidget: PGTKAPIWidget);
|
procedure GTKAPIWidget_HideCaret(APIWidget: PGTKAPIWidget);
|
||||||
procedure GTKAPIWidget_ShowCaret(APIWidget: PGTKAPIWidget);
|
procedure GTKAPIWidget_ShowCaret(APIWidget: PGTKAPIWidget);
|
||||||
procedure GTKAPIWidget_SetCaretPos(APIWidget: PGTKAPIWidget; X, Y: Integer);
|
procedure GTKAPIWidget_SetCaretPos(APIWidget: PGTKAPIWidget; X, Y: Integer);
|
||||||
@ -67,9 +68,9 @@ type
|
|||||||
Y: Integer;
|
Y: Integer;
|
||||||
Width: Integer;
|
Width: Integer;
|
||||||
Height: Integer;
|
Height: Integer;
|
||||||
Visible: Boolean;
|
Visible: Boolean; // Caret is on
|
||||||
IsDrawn: Boolean;
|
IsDrawn: Boolean; // Caret is visible at the moment
|
||||||
BlinkHide: Boolean;
|
Blinking: Boolean; // Caret should blink
|
||||||
Pixmap: PGDKPixMap;
|
Pixmap: PGDKPixMap;
|
||||||
BackPixmap: PGDKPixMap;
|
BackPixmap: PGDKPixMap;
|
||||||
Timer: guint;
|
Timer: guint;
|
||||||
@ -77,6 +78,7 @@ type
|
|||||||
|
|
||||||
PGTKAPIWidgetClient = ^TGTKAPIWidgetClient;
|
PGTKAPIWidgetClient = ^TGTKAPIWidgetClient;
|
||||||
TGTKAPIWidgetClient = record
|
TGTKAPIWidgetClient = record
|
||||||
|
// ! the Widget must be the first attribute of the record !
|
||||||
Widget: TGTKWidget;
|
Widget: TGTKWidget;
|
||||||
OtherWindow: PGDKWindow;
|
OtherWindow: PGDKWindow;
|
||||||
Caret: TCaretInfo;
|
Caret: TCaretInfo;
|
||||||
@ -85,14 +87,14 @@ type
|
|||||||
PGTKAPIWidgetClientClass = ^TGTKAPIWidgetClientClass;
|
PGTKAPIWidgetClientClass = ^TGTKAPIWidgetClientClass;
|
||||||
TGTKAPIWidgetClientClass = record
|
TGTKAPIWidgetClientClass = record
|
||||||
ParentClass: TGTKWidgetClass;
|
ParentClass: TGTKWidgetClass;
|
||||||
set_scroll_adjustments: procedure(Widget: PGTKWidget; HAdjustment, VAdjustment: PGTKAdjustment); cdecl;
|
set_scroll_adjustments: procedure(Widget: PGTKWidget;
|
||||||
|
HAdjustment, VAdjustment: PGTKAdjustment); cdecl;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure GTKAPIWidgetClient_DrawCaret(Client: PGTKAPIWidgetClient); forward;
|
procedure GTKAPIWidgetClient_DrawCaret(Client: PGTKAPIWidgetClient); forward;
|
||||||
|
|
||||||
function GTKAPIWidgetClient_Timer(Client: Pointer): gint; cdecl;
|
function GTKAPIWidgetClient_Timer(Client: Pointer): gint; cdecl;
|
||||||
begin
|
begin
|
||||||
with PGTKAPIWidgetClient(Client)^.Caret do BlinkHide := not BlinkHide;
|
|
||||||
GTKAPIWidgetClient_DrawCaret(Client);
|
GTKAPIWidgetClient_DrawCaret(Client);
|
||||||
Result := 1; { returning 0 would stop the timer, 1 will restart it }
|
Result := 1; { returning 0 would stop the timer, 1 will restart it }
|
||||||
end;
|
end;
|
||||||
@ -127,7 +129,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
AttributesMask := GDK_WA_X or GDK_WA_Y or GDK_WA_VISUAL or GDK_WA_COLORMAP;
|
AttributesMask := GDK_WA_X or GDK_WA_Y or GDK_WA_VISUAL or GDK_WA_COLORMAP;
|
||||||
|
|
||||||
Widget^.Window := gdk_window_new(gtk_widget_get_parent_window(Widget), @Attributes, AttributesMask);
|
Widget^.Window := gdk_window_new(gtk_widget_get_parent_window(Widget),
|
||||||
|
@Attributes, AttributesMask);
|
||||||
|
|
||||||
gdk_window_set_user_data(Widget^.Window, Client);
|
gdk_window_set_user_data(Widget^.Window, Client);
|
||||||
|
|
||||||
@ -154,17 +157,22 @@ end;
|
|||||||
procedure GTKAPIWidgetClient_UnRealize(Widget: PGTKWidget); cdecl;
|
procedure GTKAPIWidgetClient_UnRealize(Widget: PGTKWidget); cdecl;
|
||||||
begin
|
begin
|
||||||
with PGTKAPIWidgetClient(Widget)^.Caret do
|
with PGTKAPIWidgetClient(Widget)^.Caret do
|
||||||
if Timer <> 0 then gtk_timeout_remove(Timer);
|
if Timer <> 0 then begin
|
||||||
|
gtk_timeout_remove(Timer);
|
||||||
|
Timer:=0;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GTKAPIWidgetClient_KeyPress(Widget: PGTKWidget; Event: PGDKEventKey): gint; cdecl;
|
function GTKAPIWidgetClient_KeyPress(Widget: PGTKWidget;
|
||||||
|
Event: PGDKEventKey): gint; cdecl;
|
||||||
begin
|
begin
|
||||||
// Assert(False, 'Trace:[GTKAPIWidgetClient_KeyPress]');
|
// Assert(False, 'Trace:[GTKAPIWidgetClient_KeyPress]');
|
||||||
// supress further processing
|
// supress further processing
|
||||||
Result := gtk_True;
|
Result := gtk_True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GTKAPIWidgetClient_ButtonPress(Widget: PGTKWidget; Event: PGDKEventButton): gint; cdecl;
|
function GTKAPIWidgetClient_ButtonPress(Widget: PGTKWidget;
|
||||||
|
Event: PGDKEventButton): gint; cdecl;
|
||||||
begin
|
begin
|
||||||
if not gtk_widget_has_focus(Widget)
|
if not gtk_widget_has_focus(Widget)
|
||||||
then gtk_widget_grab_focus(Widget);
|
then gtk_widget_grab_focus(Widget);
|
||||||
@ -172,7 +180,8 @@ begin
|
|||||||
Result := gtk_False;
|
Result := gtk_False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GTKAPIWidgetClient_FocusIn(Widget: PGTKWidget; Event: PGdkEventFocus): gint; cdecl;
|
function GTKAPIWidgetClient_FocusIn(Widget: PGTKWidget;
|
||||||
|
Event: PGdkEventFocus): gint; cdecl;
|
||||||
begin
|
begin
|
||||||
// Assert(False, 'Trace:[GTKAPIWidgetClient_FocusIn]');
|
// Assert(False, 'Trace:[GTKAPIWidgetClient_FocusIn]');
|
||||||
gtk_widget_set_flags(Widget, GTK_HAS_FOCUS);
|
gtk_widget_set_flags(Widget, GTK_HAS_FOCUS);
|
||||||
@ -180,7 +189,8 @@ begin
|
|||||||
Result := gtk_False;
|
Result := gtk_False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GTKAPIWidgetClient_FocusOut(Widget: PGTKWidget; Event: PGdkEventFocus): gint; cdecl;
|
function GTKAPIWidgetClient_FocusOut(Widget: PGTKWidget;
|
||||||
|
Event: PGdkEventFocus): gint; cdecl;
|
||||||
begin
|
begin
|
||||||
// Assert(False, 'Trace:[GTKAPIWidgetClient_FocusOut]');
|
// Assert(False, 'Trace:[GTKAPIWidgetClient_FocusOut]');
|
||||||
gtk_widget_unset_flags(Widget, GTK_HAS_FOCUS);
|
gtk_widget_unset_flags(Widget, GTK_HAS_FOCUS);
|
||||||
@ -188,7 +198,7 @@ begin
|
|||||||
Result := gtk_False;
|
Result := gtk_False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure GTKAPIWidgetClient_ClassInit(theClass: PGTKAPIWidgetClientClass); cdecl;
|
procedure GTKAPIWidgetClient_ClassInit(theClass: PGTKAPIWidgetClientClass);cdecl;
|
||||||
var
|
var
|
||||||
ObjectClass: PGTKObjectClass;
|
ObjectClass: PGTKObjectClass;
|
||||||
WidgetClass: PGTKWidgetClass;
|
WidgetClass: PGTKWidgetClass;
|
||||||
@ -221,15 +231,15 @@ begin
|
|||||||
theClass^.set_scroll_adjustments := nil;
|
theClass^.set_scroll_adjustments := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure GTKAPIWidgetClient_Init(Client: PGTKAPIWidgetClient; theClass: PGTKAPIWidgetClientClass); cdecl;
|
procedure GTKAPIWidgetClient_Init(Client: PGTKAPIWidgetClient;
|
||||||
|
theClass: PGTKAPIWidgetClientClass); cdecl;
|
||||||
begin
|
begin
|
||||||
gtk_widget_set_flags(PGTKWidget(Client), GTK_CAN_FOCUS);
|
gtk_widget_set_flags(PGTKWidget(Client), GTK_CAN_FOCUS);
|
||||||
|
|
||||||
with Client^.Caret do
|
with Client^.Caret do begin
|
||||||
begin
|
|
||||||
Visible := False;
|
Visible := False;
|
||||||
IsDrawn := False;
|
IsDrawn := False;
|
||||||
BlinkHide := False;
|
Blinking := True;
|
||||||
X := 0;
|
X := 0;
|
||||||
Y := 0;
|
Y := 0;
|
||||||
Width := 1;
|
Width := 1;
|
||||||
@ -245,8 +255,8 @@ const
|
|||||||
TheType: Guint = 0;
|
TheType: Guint = 0;
|
||||||
Info: TGTKTypeInfo = (
|
Info: TGTKTypeInfo = (
|
||||||
type_name: 'LCLWinapiClient';
|
type_name: 'LCLWinapiClient';
|
||||||
object_size: SizeOf(TGTKAPIWidgetClient);
|
object_size: SizeOf(TGTKAPIWidgetClient)+100;
|
||||||
class_size: SizeOf(TGTKAPIWidgetClientClass);
|
class_size: SizeOf(TGTKAPIWidgetClientClass)+100;
|
||||||
class_init_func: @GTKAPIWidgetClient_ClassInit;
|
class_init_func: @GTKAPIWidgetClient_ClassInit;
|
||||||
object_init_func : @GTKAPIWidgetClient_Init;
|
object_init_func : @GTKAPIWidgetClient_Init;
|
||||||
);
|
);
|
||||||
@ -276,50 +286,53 @@ end;
|
|||||||
|
|
||||||
procedure GTKAPIWidgetClient_DrawCaret(Client: PGTKAPIWidgetClient);
|
procedure GTKAPIWidgetClient_DrawCaret(Client: PGTKAPIWidgetClient);
|
||||||
const
|
const
|
||||||
GC_STATE: array[Boolean] of TGtkStateType = (GTK_STATE_INSENSITIVE, GTK_STATE_NORMAL);
|
GC_STATE: array[Boolean] of TGtkStateType =
|
||||||
|
(GTK_STATE_INSENSITIVE, GTK_STATE_NORMAL);
|
||||||
var
|
var
|
||||||
Widget: PGTKWidget;
|
Widget: PGTKWidget;
|
||||||
begin
|
begin
|
||||||
|
if Client = nil then begin
|
||||||
|
WriteLn('WARNING: [GTKAPIWidgetClient_DrawCaret] Got nil client');
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
Widget := PGTKWidget(Client);
|
Widget := PGTKWidget(Client);
|
||||||
|
|
||||||
with Client^.Caret do
|
with Client^.Caret do begin
|
||||||
begin
|
if (Timer <> 0) and ((not Blinking) or (not Visible)) then begin
|
||||||
//hide
|
gtk_timeout_remove(Timer);
|
||||||
if IsDrawn
|
Timer := 0;
|
||||||
then begin
|
end;
|
||||||
if (Timer <> 0) and not BlinkHide
|
|
||||||
then begin
|
if IsDrawn and ((not Visible) or Blinking) then begin
|
||||||
gtk_timeout_remove(Timer);
|
// hide caret
|
||||||
Timer := 0;
|
if (BackPixmap <> nil) and (Widget<>nil) and (Widget^.theStyle<>nil)
|
||||||
end;
|
|
||||||
IsDrawn := False;
|
|
||||||
if (BackPixmap <> nil) and (Widget^.theStyle<>nil)
|
|
||||||
then gdk_draw_pixmap(
|
then gdk_draw_pixmap(
|
||||||
Widget^.Window,
|
Widget^.Window,
|
||||||
PGTKStyle(Widget^.theStyle)^.bg_gc[GTK_STATE_NORMAL],
|
PGTKStyle(Widget^.theStyle)^.bg_gc[GTK_STATE_NORMAL],
|
||||||
BackPixmap, 0, 0, X, Y, Width, Height
|
BackPixmap, 0, 0, X, Y, Width, Height
|
||||||
);
|
);
|
||||||
end;
|
IsDrawn := False;
|
||||||
|
end
|
||||||
|
else
|
||||||
if Visible
|
if Visible
|
||||||
and not BlinkHide
|
|
||||||
and gtk_widget_has_focus(PGTKWidget(Client))
|
and gtk_widget_has_focus(PGTKWidget(Client))
|
||||||
and not IsDrawn
|
and (not IsDrawn)
|
||||||
then begin
|
then begin
|
||||||
if Pixmap <> nil then Assert(False, 'Trace:TODO: [GTKAPIWidgetClient_ShowCaret] Implement bitmap');
|
if Pixmap <> nil then
|
||||||
|
Assert(False, 'Trace:TODO: [GTKAPIWidgetClient_ShowCaret] Implement bitmap');
|
||||||
|
|
||||||
//Create backbitmap if needed
|
//Create backbitmap if needed
|
||||||
if BackPixmap = nil
|
if BackPixmap = nil
|
||||||
then BackPixmap := gdk_pixmap_new(Widget^.Window, Width, Height, -1);
|
then BackPixmap := gdk_pixmap_new(Widget^.Window, Width, Height, -1);
|
||||||
|
|
||||||
if (BackPixmap <> nil) and (Widget<>nil) and (PGTKStyle(Widget^.theStyle)<>nil)
|
if (BackPixmap <> nil) and (Widget<>nil) and ((Widget^.theStyle)<>nil)
|
||||||
then gdk_draw_pixmap(
|
then gdk_draw_pixmap(
|
||||||
BackPixmap,
|
BackPixmap,
|
||||||
PGTKStyle(Widget^.theStyle)^.bg_gc[GTK_STATE_NORMAL],
|
PGTKStyle(Widget^.theStyle)^.bg_gc[GTK_STATE_NORMAL],
|
||||||
Widget^.Window, X, Y, 0, 0, Width, Height
|
Widget^.Window, X, Y, 0, 0, Width, Height
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// draw caret
|
||||||
if PGTKStyle(PGTKWidget(Client)^.theStyle)<>nil then
|
if PGTKStyle(PGTKWidget(Client)^.theStyle)<>nil then
|
||||||
gdk_draw_rectangle(
|
gdk_draw_rectangle(
|
||||||
PGTKWidget(Client)^.Window,
|
PGTKWidget(Client)^.Window,
|
||||||
@ -327,9 +340,10 @@ begin
|
|||||||
1, X, Y, Width, Height
|
1, X, Y, Width, Height
|
||||||
);
|
);
|
||||||
IsDrawn := True;
|
IsDrawn := True;
|
||||||
|
|
||||||
if Timer = 0 then Timer := gtk_timeout_add(500, @GTKAPIWidgetClient_Timer, Client);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if Visible and Blinking and (Timer = 0) then
|
||||||
|
Timer := gtk_timeout_add(500, @GTKAPIWidgetClient_Timer, Client);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -345,7 +359,8 @@ begin
|
|||||||
GTKAPIWidgetClient_DrawCaret(Client);
|
GTKAPIWidgetClient_DrawCaret(Client);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure GTKAPIWidgetClient_CreateCaret(Client: PGTKAPIWidgetClient; AWidth, AHeight: Integer; ABitmap: PGDKPixmap);
|
procedure GTKAPIWidgetClient_CreateCaret(Client: PGTKAPIWidgetClient;
|
||||||
|
AWidth, AHeight: Integer; ABitmap: PGDKPixmap);
|
||||||
var
|
var
|
||||||
IsVisible: Boolean;
|
IsVisible: Boolean;
|
||||||
begin
|
begin
|
||||||
@ -374,7 +389,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure GTKAPIWidgetClient_SetCaretPos(Client: PGTKAPIWidgetClient; AX, AY: Integer);
|
procedure GTKAPIWidgetClient_SetCaretPos(Client: PGTKAPIWidgetClient;
|
||||||
|
AX, AY: Integer);
|
||||||
var
|
var
|
||||||
IsVisible: Boolean;
|
IsVisible: Boolean;
|
||||||
begin
|
begin
|
||||||
@ -388,7 +404,7 @@ begin
|
|||||||
|
|
||||||
with Client^.Caret do
|
with Client^.Caret do
|
||||||
begin
|
begin
|
||||||
IsVisible := Visible; //use redraw, visible is changed
|
IsVisible := Visible;
|
||||||
if IsVisible then GTKAPIWidgetClient_HideCaret(Client);
|
if IsVisible then GTKAPIWidgetClient_HideCaret(Client);
|
||||||
X := AX;
|
X := AX;
|
||||||
Y := AY;
|
Y := AY;
|
||||||
@ -396,7 +412,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure GTKAPIWidgetClient_GetCaretPos(Client: PGTKAPIWidgetClient; var X, Y: Integer);
|
procedure GTKAPIWidgetClient_GetCaretPos(Client: PGTKAPIWidgetClient;
|
||||||
|
var X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if Client = nil
|
if Client = nil
|
||||||
then begin
|
then begin
|
||||||
@ -471,8 +488,8 @@ const
|
|||||||
wawType: Guint = 0;
|
wawType: Guint = 0;
|
||||||
wawInfo: TGTKTypeInfo = (
|
wawInfo: TGTKTypeInfo = (
|
||||||
type_name: 'LCLWinapiWidget';
|
type_name: 'LCLWinapiWidget';
|
||||||
object_size: SizeOf(TGTKAPIWidget);
|
object_size: SizeOf(TGTKAPIWidget)+100;
|
||||||
class_size: SizeOf(TGTKAPIWidgetClass);
|
class_size: SizeOf(TGTKAPIWidgetClass)+100;
|
||||||
class_init_func: @GTKAPIWidget_ClassInit;
|
class_init_func: @GTKAPIWidget_ClassInit;
|
||||||
object_init_func : @GTKAPIWidget_Init;
|
object_init_func : @GTKAPIWidget_Init;
|
||||||
);
|
);
|
||||||
@ -552,6 +569,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.8 2001/06/12 18:31:01 lazarus
|
||||||
|
MG: small bugfixes
|
||||||
|
|
||||||
Revision 1.7 2001/06/04 09:32:17 lazarus
|
Revision 1.7 2001/06/04 09:32:17 lazarus
|
||||||
MG: fixed bugs and cleaned up messages
|
MG: fixed bugs and cleaned up messages
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user