diff --git a/components/thtmlport/demo_src/demounit.pas b/components/thtmlport/demo_src/demounit.pas index cbd0e4b06..30cc20a63 100755 --- a/components/thtmlport/demo_src/demounit.pas +++ b/components/thtmlport/demo_src/demounit.pas @@ -197,6 +197,9 @@ for I := 0 to MaxHistories-1 do MainMenu.Items.Insert(0, AppMenu); MainMenu.Items.Remove(About1); //Remove About as separate menu AppMenu.Add(About1); //Add About as item in application menu + + Find1.ShortCut := ShortCut(VK_F, [ssMeta]); + CopyItem.ShortCut := ShortCut(VK_C, [ssMeta]); {$ENDIF} {$IFDEF MSWINDOWS} diff --git a/components/thtmlport/demo_src/fdemunit.pas b/components/thtmlport/demo_src/fdemunit.pas index 3adbbf8ff..6fd3030c9 100755 --- a/components/thtmlport/demo_src/fdemunit.pas +++ b/components/thtmlport/demo_src/fdemunit.pas @@ -190,6 +190,9 @@ for I := 0 to MaxHistories-1 do MainMenu1.Items.Insert(0, AppMenu); MainMenu1.Items.Remove(About1); //Remove About as separate menu AppMenu.Add(About1); //Add About as item in application menu + + Find1.ShortCut := ShortCut(VK_F, [ssMeta]); + Copy1.ShortCut := ShortCut(VK_C, [ssMeta]); {$ENDIF} {$IFDEF MSWINDOWS} diff --git a/components/thtmlport/demo_src/framedem.lpi b/components/thtmlport/demo_src/framedem.lpi index 9fdffcae8..db77518de 100755 --- a/components/thtmlport/demo_src/framedem.lpi +++ b/components/thtmlport/demo_src/framedem.lpi @@ -35,7 +35,7 @@ - + @@ -46,6 +46,20 @@ + + + + + + + + + + + + + + diff --git a/components/thtmlport/demo_src/htmldemo.lpi b/components/thtmlport/demo_src/htmldemo.lpi index 46d29828e..095b86c41 100755 --- a/components/thtmlport/demo_src/htmldemo.lpi +++ b/components/thtmlport/demo_src/htmldemo.lpi @@ -35,7 +35,7 @@ - + @@ -46,6 +46,20 @@ + + + + + + + + + + + + + + diff --git a/components/thtmlport/package/htmlcomp.lpk b/components/thtmlport/package/htmlcomp.lpk index 06cd95475..5efb12019 100644 --- a/components/thtmlport/package/htmlcomp.lpk +++ b/components/thtmlport/package/htmlcomp.lpk @@ -26,7 +26,7 @@ - + diff --git a/components/thtmlport/package/htmlmisc.pas b/components/thtmlport/package/htmlmisc.pas index df1087e44..4fecca27e 100755 --- a/components/thtmlport/package/htmlmisc.pas +++ b/components/thtmlport/package/htmlmisc.pas @@ -410,7 +410,8 @@ const PHYSICALOFFSETY = 113; BM_SETCHECK = $00F1; - NUMCOLORS = 24; + PLANES = 14; + NUMCOLORS = 24; STRETCH_DELETESCANS = 3; CP_ACP = 0; {ANSI code page} CP_OEMCP = 1; {OEM code page } @@ -807,6 +808,7 @@ begin {$IFDEF MSWINDOWS} Result := Windows.SetViewportExtEx(DC, XExt, YExt, Size); {$ELSE} +// Result := LclIntf.SetViewportExtEx(DC, XExt, YExt, Size); Result := True; {$ENDIF} end; @@ -862,7 +864,15 @@ end; function GetDeviceCaps(DC: HDC; Index: Integer): Integer; begin if DC <> 1 then - Result := LclIntf.GetDeviceCaps(DC, Index) + begin + {First check for Index values that may not be implemented in widgetset} + if Index = PLANES then + Result := 1 + else if Index = NUMCOLORS then + Result := 100 {Return large enough value so not BxW device} + else + Result := LclIntf.GetDeviceCaps(DC, Index); + end else //Assume dummy DC is for CUPS printer canvas. begin case Index of diff --git a/components/thtmlport/package/htmlun2.pas b/components/thtmlport/package/htmlun2.pas index 139da0e0e..2f9734483 100755 --- a/components/thtmlport/package/htmlun2.pas +++ b/components/thtmlport/package/htmlun2.pas @@ -1608,6 +1608,7 @@ inherited Destroy; end; procedure ClipBuffer.CopyToClipboard; +{$IFNDEF LCL} {Unicode clipboard routine courtesy Mike Lischke} var Data: THandle; @@ -1618,9 +1619,7 @@ begin DataPtr := GlobalLock(Data); try Move(Buffer^, DataPtr^, 2 * BufferLeng); -{$IFNDEF LCL} //For now Clipboard.SetAsHandle(CF_UNICODETEXT, Data); -{$ENDIF} finally GlobalUnlock(Data); end; @@ -1628,6 +1627,13 @@ begin GlobalFree(Data); raise; end; +{$ELSE} +var + Utf8Str : string; +begin + Utf8Str := WideCharLenToString(Buffer, BufferLeng); + Clipboard.AddFormat(CF_TEXT, Utf8Str[1], Length(Utf8Str)); +{$ENDIF} end; function ClipBuffer.Terminate: integer; diff --git a/components/thtmlport/package/htmlview.pas b/components/thtmlport/package/htmlview.pas index 46c36c56c..6a85d4516 100755 --- a/components/thtmlport/package/htmlview.pas +++ b/components/thtmlport/package/htmlview.pas @@ -3564,22 +3564,23 @@ try FreeAndNil(HeadViewer); FreeAndNil(FootViewer); if hRgnClip <> 0 then DeleteObject(hrgnClip); +{$IFNDEF LCL} if not PrinterOpen then begin -{$IFNDEF LCL} if (FromPage > FPage) then vwPrinter.Abort else vwPrinter.EndDoc; vwSetPrinter(OldPrinter); FreeAndNil(vwP); -{$ELSE} - if (FromPage > FPage) then - Printer.Abort - else - Printer.EndDoc; -{$ENDIF} end; +{$ELSE} + if (FromPage > FPage) then + Printer.Abort + else + Printer.EndDoc; + vwP := nil; +{$ENDIF} Dec(FPage); end; finally @@ -3618,6 +3619,7 @@ if Assigned(vwP) then {$ELSE} if vwP.Printing then Printer.EndDoc; + vwP := nil; {$ENDIF} end; end; @@ -3634,6 +3636,7 @@ if Assigned(vwP) then {$ELSE} if vwP.Printing then Printer.Abort; + vwP := nil; {$ENDIF} end; end; @@ -4349,7 +4352,11 @@ var HTML: string; format : UINT; +{$IFNDEF LCL} procedure copyFormatToClipBoard(const source: string; format : UINT); +{$ELSE} //changed to var to use with AddFormat below + procedure copyFormatToClipBoard(var source: string; format : UINT); +{$ENDIF} // Put SOURCE on the clipboard, using FORMAT as the clipboard format // Based on http://www.lorriman.com/programming/cf_html.html var @@ -4365,6 +4372,8 @@ var copymemory(lp, pchar(source), length(source)+1); globalunlock(gMem); setClipboarddata(format, gMem); +{$ELSE} + clipboard.AddFormat(format, source[1], Length(source)); {$ENDIF} finally clipboard.Close; @@ -4579,7 +4588,11 @@ HTML := HTML+EndFrag; {Add the header to start} HTML := GetHeader(HTML)+HTML; +{$IFNDEF LCL} format := RegisterClipboardFormat('HTML Format'); {not sure this is necessary} +{$ELSE} +format := RegisterClipboardFormat('text/html'); +{$ENDIF} CopyFormatToClipBoard(HTML, format); end; @@ -5105,7 +5118,8 @@ with FViewer do if FSectionList.Printing then Exit; {no background} - ARect := Canvas.ClipRect; +// ARect := Canvas.ClipRect; //bug? get invalid DC with Carbon + ARect := ACanvas.ClipRect; Image := FSectionList.BackgroundBitmap; if FSectionList.ShowImages and Assigned(Image) then begin diff --git a/components/thtmlport/package/stylepars.pas b/components/thtmlport/package/stylepars.pas index bd1800a1d..7293c4086 100644 --- a/components/thtmlport/package/stylepars.pas +++ b/components/thtmlport/package/stylepars.pas @@ -733,8 +733,10 @@ repeat Value := Value+LCh; GetCh; end; - Value1 := Trim(Lowercase(Value)); {leave quotes on for font:} - Value := RemoveQuotes(Value1); +// Value1 := Trim(Lowercase(Value)); {leave quotes on for font:} //Mac font names are case sensitive +// Value := RemoveQuotes(Value1); + Value1 := Trim(Value); {leave quotes on for font:} + Value := RemoveQuotes(LowerCase(Value1)); if FindShortHand(Prop, Index) then case Index of MarginX, BorderWidthX, PaddingX, BorderColorX, BorderStyleX: @@ -885,7 +887,8 @@ var begin LinkPath := ''; -S := Lowercase(PropertyStr); +//S := Lowercase(PropertyStr); //Mac font names are case sensitive +S := PropertyStr; I := 1; GetCh; repeat @@ -908,7 +911,7 @@ repeat GetCh; end; Value1 := Trim(Value); {leave quotes on for font} - Value := RemoveQuotes(Value1); + Value := RemoveQuotes(LowerCase(Value1)); //added LowerCase here since no longer doing it above if FindShortHand(Prop, Index) then case Index of diff --git a/components/thtmlport/sample3.htm b/components/thtmlport/sample3.htm index b8605393d..8a939f327 100644 --- a/components/thtmlport/sample3.htm +++ b/components/thtmlport/sample3.htm @@ -56,7 +56,7 @@ the HTML document.

  • Font Faces
    • Times New Roman
    • Arial
    • -
    • ñ¸(6 (WingDings)
    • +
    • ñ¸(6 (Wingdings)
  • Font Sizes 1 2 3 Color Syntax

    Color information may consist of a hexidecimal red, green, and blue value such as FF8000 or be one of the following identifiers:

    -

    Black, Maroon, Green, Olive, Navy, Purple, Teal, Gray, +

    Black, Maroon, Green, Olive, Navy, Purple, Teal, Gray, Silver, Red, Lime, Yellow, Blue, Fuchsia, Aqua, white, Aliceblue, Antiquewhite, Aquamarine, Azure, Beige, Bisque, Blanchedalmond, Blueviolet, Brown, Burlywood, Cadetblue, Chartreuse, Chocolate, Coral, Cornflowerblue, Cornsilk, Crimson, Cyan, Darkblue, Darkcyan, Darkgoldenrod, Darkgray, Darkgreen, Darkkhaki, Darkmagenta, Darkolivegreen,