diff options
-rw-r--r-- | prototypes/fpgui2/tests/drawtest.lpi | 52 | ||||
-rw-r--r-- | prototypes/fpgui2/tests/drawtest.lpr | 2 | ||||
-rw-r--r-- | prototypes/fpgui2/tests/edittest.dpr | 1 | ||||
-rw-r--r-- | prototypes/fpgui2/tests/edittest.lpi | 7 | ||||
-rw-r--r-- | src/corelib/fpgfx.pas | 4 | ||||
-rw-r--r-- | src/corelib/gdi/gfx_gdi.pas | 2 | ||||
-rw-r--r-- | src/corelib/gfx_widget.pas | 4 | ||||
-rw-r--r-- | src/corelib/x11/gfx_x11.pas | 7 | ||||
-rw-r--r-- | src/gui/gui_combobox.pas | 19 | ||||
-rw-r--r-- | src/gui/gui_edit.pas | 7 | ||||
-rw-r--r-- | src/gui/gui_memo.pas | 45 | ||||
-rw-r--r-- | src/gui/gui_scrollbar.pas | 6 |
12 files changed, 75 insertions, 81 deletions
diff --git a/prototypes/fpgui2/tests/drawtest.lpi b/prototypes/fpgui2/tests/drawtest.lpi index 9ae3898f..eeeedae5 100644 --- a/prototypes/fpgui2/tests/drawtest.lpi +++ b/prototypes/fpgui2/tests/drawtest.lpi @@ -1,11 +1,11 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="\"/> + <PathDelim Value="/"/> <Version Value="5"/> <General> <MainUnit Value="0"/> - <IconPath Value=".\"/> + <IconPath Value="./"/> <TargetFileExt Value=""/> <ActiveEditorIndexAtStart Value="0"/> </General> @@ -16,7 +16,6 @@ </VersionInfo> <PublishOptions> <Version Value="2"/> - <DestinationDirectory Value="$(TestDir)\publishedproject\"/> <IgnoreBinaries Value="False"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> @@ -24,7 +23,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -37,23 +36,21 @@ <Filename Value="drawtest.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="drawtest"/> - <CursorPos X="23" Y="37"/> - <TopLine Value="29"/> + <CursorPos X="42" Y="66"/> + <TopLine Value="50"/> <EditorIndex Value="0"/> <UsageCount Value="24"/> <Loaded Value="True"/> </Unit0> <Unit1> - <Filename Value="..\..\..\src\corelib\gfx_imgfmt_bmp.pas"/> + <Filename Value="../../../src/corelib/gfx_imgfmt_bmp.pas"/> <UnitName Value="gfx_imgfmt_bmp"/> <CursorPos X="24" Y="18"/> <TopLine Value="1"/> - <EditorIndex Value="5"/> <UsageCount Value="12"/> - <Loaded Value="True"/> </Unit1> <Unit2> - <Filename Value="..\..\..\src\corelib\predefinedcolors.inc"/> + <Filename Value="../../../src/corelib/predefinedcolors.inc"/> <CursorPos X="15" Y="112"/> <TopLine Value="102"/> <EditorIndex Value="1"/> @@ -61,7 +58,7 @@ <Loaded Value="True"/> </Unit2> <Unit3> - <Filename Value="..\..\..\src\corelib\gfxbase.pas"/> + <Filename Value="../../../src/corelib/gfxbase.pas"/> <UnitName Value="gfxbase"/> <CursorPos X="17" Y="240"/> <TopLine Value="230"/> @@ -70,7 +67,7 @@ <Loaded Value="True"/> </Unit3> <Unit4> - <Filename Value="..\..\..\src\corelib\x11\gfx_x11.pas"/> + <Filename Value="../../../src/corelib/x11/gfx_x11.pas"/> <UnitName Value="gfx_x11"/> <CursorPos X="63" Y="1444"/> <TopLine Value="1432"/> @@ -79,83 +76,81 @@ <Loaded Value="True"/> </Unit4> <Unit5> - <Filename Value="..\..\..\src\corelib\gdi\gfx_gdi.pas"/> + <Filename Value="../../../src/corelib/gdi/gfx_gdi.pas"/> <UnitName Value="gfx_gdi"/> - <CursorPos X="31" Y="1231"/> - <TopLine Value="1193"/> - <EditorIndex Value="4"/> + <CursorPos X="9" Y="1252"/> + <TopLine Value="1250"/> <UsageCount Value="12"/> - <Loaded Value="True"/> </Unit5> <Unit6> - <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\objpas\classes\classesh.inc"/> + <Filename Value="../../../../../FPC/2.0.x/src/rtl/objpas/classes/classesh.inc"/> <CursorPos X="14" Y="25"/> <TopLine Value="15"/> <UsageCount Value="10"/> </Unit6> <Unit7> - <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\objpas\types.pp"/> + <Filename Value="../../../../../FPC/2.0.x/src/rtl/objpas/types.pp"/> <UnitName Value="types"/> <CursorPos X="13" Y="21"/> <TopLine Value="5"/> <UsageCount Value="10"/> </Unit7> <Unit8> - <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\windows.pp"/> + <Filename Value="../../../../../FPC/2.0.x/src/rtl/win32/windows.pp"/> <UnitName Value="windows"/> <CursorPos X="7" Y="33"/> <TopLine Value="21"/> <UsageCount Value="10"/> </Unit8> <Unit9> - <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\wininc\struct.inc"/> + <Filename Value="../../../../../FPC/2.0.x/src/rtl/win32/wininc/struct.inc"/> <CursorPos X="12" Y="220"/> <TopLine Value="210"/> <UsageCount Value="10"/> </Unit9> <Unit10> - <Filename Value="..\..\..\src\gui\gui_listbox.pas"/> + <Filename Value="../../../src/gui/gui_listbox.pas"/> <UnitName Value="gui_listbox"/> <CursorPos X="1" Y="516"/> <TopLine Value="506"/> <UsageCount Value="10"/> </Unit10> <Unit11> - <Filename Value="..\..\..\src\gui\gui_button.pas"/> + <Filename Value="../../../src/gui/gui_button.pas"/> <UnitName Value="gui_button"/> <CursorPos X="1" Y="221"/> <TopLine Value="210"/> <UsageCount Value="10"/> </Unit11> <Unit12> - <Filename Value="..\..\..\src\gui\gui_combobox.pas"/> + <Filename Value="../../../src/gui/gui_combobox.pas"/> <UnitName Value="gui_combobox"/> <CursorPos X="11" Y="287"/> <TopLine Value="269"/> <UsageCount Value="10"/> </Unit12> <Unit13> - <Filename Value="..\..\..\src\gui\gui_edit.pas"/> + <Filename Value="../../../src/gui/gui_edit.pas"/> <UnitName Value="gui_edit"/> <CursorPos X="12" Y="215"/> <TopLine Value="204"/> <UsageCount Value="10"/> </Unit13> <Unit14> - <Filename Value="..\..\..\src\gui\gui_memo.pas"/> + <Filename Value="../../../src/gui/gui_memo.pas"/> <UnitName Value="gui_memo"/> <CursorPos X="11" Y="636"/> <TopLine Value="625"/> <UsageCount Value="10"/> </Unit14> <Unit15> - <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\wininc\func.inc"/> + <Filename Value="../../../../../FPC/2.0.x/src/rtl/win32/wininc/func.inc"/> <CursorPos X="1" Y="753"/> <TopLine Value="745"/> <UsageCount Value="10"/> </Unit15> <Unit16> - <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\wininc\redef.inc"/> + <Filename Value="../../../../../FPC/2.0.x/src/rtl/win32/wininc/redef.inc"/> <CursorPos X="18" Y="692"/> <TopLine Value="681"/> <UsageCount Value="10"/> @@ -165,7 +160,6 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> - <PathDelim Value="\"/> <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> diff --git a/prototypes/fpgui2/tests/drawtest.lpr b/prototypes/fpgui2/tests/drawtest.lpr index e7506645..5565950f 100644 --- a/prototypes/fpgui2/tests/drawtest.lpr +++ b/prototypes/fpgui2/tests/drawtest.lpr @@ -63,7 +63,7 @@ begin // FillRect Canvas.SetColor(clYellow); - Canvas.FillRectangle(111, 111, 139, 139); // inner white rectangle + Canvas.FillRectangle(111, 111, 138, 138); // inner white rectangle // line diagonal Canvas.SetColor(clRed); diff --git a/prototypes/fpgui2/tests/edittest.dpr b/prototypes/fpgui2/tests/edittest.dpr index 77234ddd..46680d03 100644 --- a/prototypes/fpgui2/tests/edittest.dpr +++ b/prototypes/fpgui2/tests/edittest.dpr @@ -300,6 +300,7 @@ begin radiobtn1.Enabled := not checkbox1.Checked; radiobtn2.Enabled := not checkbox1.Checked; radiobtn3.Enabled := not checkbox1.Checked; + combo2.Enabled := not checkbox1.Checked; end; procedure TMainForm.AfterCreate; diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi index b609d403..1ecb384f 100644 --- a/prototypes/fpgui2/tests/edittest.lpi +++ b/prototypes/fpgui2/tests/edittest.lpi @@ -1,7 +1,7 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="\"/> + <PathDelim Value="/"/> <Version Value="5"/> <General> <Flags> @@ -9,7 +9,7 @@ </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <IconPath Value=".\"/> + <IconPath Value="./"/> <TargetFileExt Value=""/> </General> <VersionInfo> @@ -23,7 +23,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -42,7 +42,6 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> - <PathDelim Value="\"/> <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> diff --git a/src/corelib/fpgfx.pas b/src/corelib/fpgfx.pas index 826a45f3..6410afde 100644 --- a/src/corelib/fpgfx.pas +++ b/src/corelib/fpgfx.pas @@ -224,6 +224,8 @@ type procedure SetCaret(acanvas: TfpgCanvas; x, y, w, h: TfpgCoord); procedure UnSetCaret(acanvas: TfpgCanvas); procedure InvertCaret; + property Width: integer read FWidth; + property Height: integer read FHeight; end; var @@ -982,7 +984,7 @@ begin FCanvas := nil; FTop := 0; FLeft := 0; - FWidth := 1; + FWidth := 2; FHeight := 8; FTimer := TfpgTimer.Create(FInterval); FTimer.OnTimer := @OnTimerTime; diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index f9a40f77..1cae9066 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -1251,7 +1251,7 @@ procedure TfpgCanvasImpl.DoFillRectangle(x1, y1, x2, y2: TfpgCoord); var r: TRect; begin - r := Rect(x1, y1, x2, y2); + r := Rect(x1, y1, x2+1, y2+1); Windows.FillRect(Fgc, r, FBrush); end; diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas index 0323eb40..24f05244 100644 --- a/src/corelib/gfx_widget.pas +++ b/src/corelib/gfx_widget.pas @@ -39,8 +39,6 @@ type procedure MsgMouseExit(var msg: TfpgMessageRec); message FPGM_MOUSEEXIT; procedure MsgMouseScroll(var msg: TfpgMessageRec); message FPGM_SCROLL; procedure SetActiveWidget(const AValue: TfpgWidget); - procedure SetEnabled(const AValue: boolean); - procedure SetVisible(const AValue: boolean); protected FVisible: boolean; FEnabled: boolean; @@ -52,6 +50,8 @@ type FAlign: TAlign; function GetParent: TfpgWidget; reintroduce; procedure SetParent(const AValue: TfpgWidget); reintroduce; + procedure SetEnabled(const AValue: boolean); virtual; + procedure SetVisible(const AValue: boolean); virtual; procedure DoAlign(aalign: TAlign); procedure HandlePaint; virtual; procedure HandleResize(awidth, aheight: TfpgCoord); virtual; diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas index ce63fdfd..65d14754 100644 --- a/src/corelib/x11/gfx_x11.pas +++ b/src/corelib/x11/gfx_x11.pas @@ -1405,12 +1405,7 @@ end; procedure TfpgCanvasImpl.DoFillRectangle(x1, y1, x2, y2: TfpgCoord); begin - // Remember this for when we add Canvas.Pen support! - { Note: By default XFillRectangle doesn't paint the same size rectangle that - XDrawRectangle does - given the same coordinates! In this case we enlarge - the Width and Height to paint consistant rectangle sizes, even thought it - might repaint the same (only a few) pixels twice. } - XFillRectangle(xapplication.display, FDrawHandle, Fgc, x1, y1, x2-x1, y2-y1); + XFillRectangle(xapplication.display, FDrawHandle, Fgc, x1, y1, x2-x1+1, y2-y1+1); end; procedure TfpgCanvasImpl.DoXORFillRectangle(col: TfpgColor; x, y, w, h: TfpgCoord); diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas index 35bb39e7..c5b35342 100644 --- a/src/gui/gui_combobox.pas +++ b/src/gui/gui_combobox.pas @@ -35,6 +35,7 @@ type procedure SetFocusItem(const AValue: integer); protected FMargin: integer; + procedure SetEnabled(const AValue: boolean); override; property DropDownCount: integer read FDropDownCount write SetDropDownCount default 8; procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override; procedure HandlePaint; override; @@ -247,6 +248,12 @@ begin FFocusItem := AValue; end; +procedure TfpgCustomComboBox.SetEnabled(const AValue: boolean); +begin + inherited SetEnabled(AValue); + FInternalBtn.Enabled := AValue; +end; + procedure TfpgCustomComboBox.HandleLMouseDown(x, y: integer; shiftstate: TShiftState); begin inherited HandleLMouseDown(x, y, shiftstate); @@ -257,13 +264,14 @@ procedure TfpgCustomComboBox.HandlePaint; var r: TRect; begin - inherited HandlePaint; Canvas.BeginDraw; +// inherited HandlePaint; Canvas.ClearClipRect; + r := Rect(0, 0, Width-1, Height-1); Canvas.DrawControlFrame(0, 0, Width, Height); // internal background rectangle (without frame) - r := Rect(2, 2, Width-2, Height-2); + InflateRect(r, -2, -2); Canvas.SetClipRect(r); if Enabled then @@ -283,14 +291,17 @@ begin end else begin - Canvas.SetColor(FBackgroundColor); + if Enabled then + Canvas.SetColor(FBackgroundColor) + else + Canvas.SetColor(clWindowBackground); Canvas.SetTextColor(clText1); end; Canvas.FillRectangle(r); // Draw select item's text if FocusItem > -1 then - Canvas.DrawString(FMargin+1, FMargin, Text); + fpgStyle.DrawString(Canvas, FMargin+1, FMargin, Text, Enabled); Canvas.EndDraw; end; diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas index 02710088..2597f976 100644 --- a/src/gui/gui_edit.pas +++ b/src/gui/gui_edit.pas @@ -207,17 +207,18 @@ var begin Canvas.BeginDraw; Canvas.ClearClipRect; + r := Rect(0, 0, Width-1, Height-1); Canvas.DrawControlFrame(0, 0, Width, Height); - r := Rect(2, 2, Width-2, Height-2); + InflateRect(r, -2, -2); Canvas.SetClipRect(r); if Enabled then Canvas.SetColor(FBackgroundColor) else Canvas.SetColor(clWindowBackground); - Canvas.FillRectAngle(r); + dtext := GetDrawText; Canvas.SetTextColor(clText1); Canvas.SetFont(FFont); @@ -244,7 +245,7 @@ begin // drawing cursor tw := FFont.TextWidth(UTF8copy(dtext, 1, FCursorPos)); - fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, 3, 2, FFont.Height - 1); + fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, 3, fpgCaret.Width, FFont.Height); end else fpgCaret.UnSetCaret(Canvas); diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas index d3ff7864..8beb96cf 100644 --- a/src/gui/gui_memo.pas +++ b/src/gui/gui_memo.pas @@ -155,6 +155,7 @@ begin FVScrollBar.Top := 2; FVScrollBar.Left := Width - FVScrollBar.Width - 2; FVScrollBar.Height := VHeight; + FVScrollBar.UpdateWindowPosition; FHScrollBar.UpdateWindowPosition; end; @@ -167,12 +168,12 @@ begin FHeight := FFont.Height * 3 + 4; FWidth := 120; FLineHeight := FFont.Height + 2; - FSelecting := False; FSideMargin := 3; FMaxLength := 0; - - FOnChange := nil; + FWrapping := False; + FOnChange := nil; + FBackgroundColor := clBoxColor; FLines := TStringList.Create; FFirstLine := 1; @@ -184,8 +185,6 @@ begin FSelStartLine := 0; FSelEndLine := 0; - FBackgroundColor := clBoxColor; - FDrawOffset := 0; FMouseDragging := False; @@ -197,8 +196,6 @@ begin FHScrollBar.Orientation := orHorizontal; FHScrollBar.OnScroll := @HScrollBarMove; FHScrollBar.ScrollStep := 5; - - FWrapping := False; end; destructor TfpgMemo.Destroy; @@ -424,7 +421,6 @@ begin end; // vertical adjust - if FCursorLine < FFirstLine then FFirstLine := FCursorLine; if FCursorline - FFirstLine + 1 > VisibleLines then @@ -590,9 +586,6 @@ end; procedure TfpgMemo.HandleShow; begin - // FVScrollBar.SetDimensions(width-18,0,18,height); - // FHScrollBar.SetDimensions(0,height-18,width-18,18); - // FHScrollBar.Visible := false; inherited HandleShow; RecalcLongestLine; UpdateScrollBar; @@ -628,20 +621,18 @@ var begin Canvas.BeginDraw; Canvas.ClearClipRect; - fpgStyle.DrawControlFrame(Canvas, 0, 0, Width, Height); + r := Rect(0, 0, Width-1, Height-1); + Canvas.DrawControlFrame(0, 0, Width, Height); - r.Left := 2; - r.Top := 2; - r.Right := Width - 4; - r.Bottom := Height - 4; + InflateRect(r, -2, -2); Canvas.SetClipRect(r); - + if Enabled then Canvas.SetColor(FBackgroundColor) else Canvas.SetColor(clWindowBackground); + Canvas.FillRectAngle(r); - Canvas.FillRectAngle(2, 2, Width - 4, Height - 4); Canvas.SetFont(FFont); if (FSelStartLine shl 16) + FSelStartPos <= (FSelEndLine shl 16) + FSelEndPos then @@ -690,21 +681,20 @@ begin begin // drawing cursor tw := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos)); - fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, yp, 1, FFont.Height); + fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, yp, fpgCaret.Width, FFont.Height); end; - - end; + end; { if } yp := yp + LineHeight; - if yp > Height then Break; - end; + end; { for } if not Focused then fpgCaret.UnSetCaret(Canvas); - if FHScrollBar.Visible and FVScrollBar.Visible then begin + if FHScrollBar.Visible and FVScrollBar.Visible then + begin Canvas.SetColor(clWindowBackground); Canvas.FillRectangle(FHScrollBar.Left + FHScrollBar.Width, FVScrollBar.Top + FVScrollBar.Height, @@ -1203,14 +1193,15 @@ begin begin if FSelOffset < 0 then begin - Result := Copy16(FText,1+FSelStart + FSelOffset,-FSelOffset); + Result := Copy(FText,1+FSelStart + FSelOffset,-FSelOffset); end else begin - result := Copy16(FText,1+FSelStart,FSelOffset); + result := Copy(FText,1+FSelStart,FSelOffset); end; end - else Result := ''; + else + Result := ''; } end; diff --git a/src/gui/gui_scrollbar.pas b/src/gui/gui_scrollbar.pas index a76e9f9a..67716276 100644 --- a/src/gui/gui_scrollbar.pas +++ b/src/gui/gui_scrollbar.pas @@ -99,7 +99,7 @@ begin if Orientation = orVertical then begin - DrawButton(0, 0, Width, Width, 'sys.sb.up' ,FStartBtnPressed); + DrawButton(0, 0, Width, Width, 'sys.sb.up', FStartBtnPressed); DrawButton(0, Height - Width, Width, Width, 'sys.sb.down', FEndBtnPressed); end else @@ -165,12 +165,12 @@ begin if Orientation = orVertical then begin - Canvas.FillRectangle(0, Width-1, Width-1, Height - (2*Width)-2); + Canvas.FillRectangle(0, Width, Width-1, Height-1 - Width); area := Height - (Width shl 1); end else begin - Canvas.FillRectangle(Height-1, 0, Width - (2*Height)-2, Height-1); + Canvas.FillRectangle(Height, 0, Width - Height-1, Height); area := Width - (Height shl 1); end; |