From: Peter T. <pe...@us...> - 2003-11-04 19:34:02
|
Update of /cvsroot/jvcl/dev/JVCL3/examples/JvCharMap In directory sc8-pr-cvs1:/tmp/cvs-serv1795/JVCL3/examples/JvCharMap Modified Files: MainFrm.dfm MainFrm.pas Log Message: - Added JvCharmap icon - Added JvCharmap to JvCtrls - Updated JvCharmap for D5 - Updated JvCharmap demo Index: MainFrm.dfm =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/examples/JvCharMap/MainFrm.dfm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainFrm.dfm 3 Nov 2003 23:08:02 -0000 1.1 --- MainFrm.dfm 4 Nov 2003 19:33:58 -0000 1.2 *************** *** 1,6 **** object Form1: TForm1 ! Left = 193 ! Top = 107 ! AutoScroll = False Caption = 'JvCharMap Demo' ClientHeight = 404 --- 1,7 ---- object Form1: TForm1 ! Left = 313 ! Top = 122 ! BorderIcons = [biSystemMenu, biMinimize] ! BorderStyle = bsSingle Caption = 'JvCharMap Demo' ClientHeight = 404 *************** *** 25,28 **** --- 26,32 ---- BevelOuter = bvLowered TabOrder = 0 + DesignSize = ( + 547 + 125) object Label1: TLabel Left = 8 *************** *** 49,53 **** FocusControl = udColumns end ! object Button2: TButton Left = 216 Top = 92 --- 53,57 ---- FocusControl = udColumns end ! object btnFont: TButton Left = 216 Top = 92 *************** *** 56,62 **** Caption = '&Font...' TabOrder = 10 ! OnClick = Button2Click end ! object CheckBox1: TCheckBox Left = 8 Top = 52 --- 60,66 ---- Caption = '&Font...' TabOrder = 10 ! OnClick = btnFontClick end ! object chkZoomPanel: TCheckBox Left = 8 Top = 52 *************** *** 67,71 **** State = cbChecked TabOrder = 6 ! OnClick = CheckBox1Click end object Edit1: TEdit --- 71,75 ---- State = cbChecked TabOrder = 6 ! OnClick = chkZoomPanelClick end object Edit1: TEdit *************** *** 123,127 **** OnClick = udColumnsClick end ! object JvColorComboBox1: TJvColorComboBox Left = 8 Top = 94 --- 127,131 ---- OnClick = udColumnsClick end ! object cbColor: TJvColorComboBox Left = 8 Top = 94 *************** *** 189,193 **** TabOrder = 8 end ! object JvFontComboBox1: TJvFontComboBox Left = 112 Top = 94 --- 193,197 ---- TabOrder = 8 end ! object cbFont: TJvFontComboBox Left = 112 Top = 94 *************** *** 199,203 **** TabOrder = 9 end ! object CheckBox2: TCheckBox Left = 126 Top = 52 --- 203,207 ---- TabOrder = 9 end ! object chkUnicode: TCheckBox Left = 126 Top = 52 *************** *** 206,220 **** Caption = '&Unicode' TabOrder = 7 ! OnClick = CheckBox2Click end ! object RichEdit1: TRichEdit Left = 312 ! Top = 16 Width = 222 ! Height = 97 Anchors = [akLeft, akTop, akRight, akBottom] ScrollBars = ssBoth ! TabOrder = 11 WordWrap = False end end --- 210,235 ---- Caption = '&Unicode' TabOrder = 7 ! OnClick = chkUnicodeClick end ! object reInfo: TRichEdit Left = 312 ! Top = 48 Width = 222 ! Height = 65 Anchors = [akLeft, akTop, akRight, akBottom] + ParentShowHint = False ScrollBars = ssBoth ! ShowHint = True ! TabOrder = 12 WordWrap = False + end + object btnSelect: TButton + Left = 448 + Top = 16 + Width = 75 + Height = 25 + Caption = 'Se&lect' + TabOrder = 11 + OnClick = btnSelectClick end end Index: MainFrm.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/examples/JvCharMap/MainFrm.pas,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainFrm.pas 3 Nov 2003 23:08:02 -0000 1.1 --- MainFrm.pas 4 Nov 2003 19:33:58 -0000 1.2 *************** *** 2,10 **** interface ! uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, JvCharMap, StdCtrls, ExtCtrls, ComCtrls, JvColorCombo, ! JvCombobox, Menus; type --- 2,13 ---- interface ! // enable this define (remove the dot) if you have Troy Wolbrink's Tnt Controls installed ! // (http://home.ccci.org/wolbrink/tnt/delphi_unicode_controls.htm) ! {.$DEFINE USETNT} uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, JvCharMap, StdCtrls, ExtCtrls, ComCtrls, JvColorCombo, ! JvCombobox, Menus ! {$IFDEF USETNT}, TntStdCtrls{$ENDIF}; type *************** *** 12,17 **** FontDialog1: TFontDialog; Panel1: TPanel; ! Button2: TButton; ! CheckBox1: TCheckBox; Label1: TLabel; Edit1: TEdit; --- 15,20 ---- FontDialog1: TFontDialog; Panel1: TPanel; ! btnFont: TButton; ! chkZoomPanel: TCheckBox; Label1: TLabel; Edit1: TEdit; *************** *** 23,47 **** Edit3: TEdit; udColumns: TUpDown; ! JvColorComboBox1: TJvColorComboBox; ! JvFontComboBox1: TJvFontComboBox; ! CheckBox2: TCheckBox; ! RichEdit1: TRichEdit; PopupMenu1: TPopupMenu; Copy1: TMenuItem; procedure FormCreate(Sender: TObject); ! procedure Button2Click(Sender: TObject); ! procedure CheckBox1Click(Sender: TObject); procedure udStartClick(Sender: TObject; Button: TUDBtnType); procedure udEndClick(Sender: TObject; Button: TUDBtnType); procedure udColumnsClick(Sender: TObject; Button: TUDBtnType); ! procedure JvFontComboBox1Change(Sender: TObject); ! procedure JvColorComboBox1Change(Sender: TObject); ! procedure CheckBox2Click(Sender: TObject); procedure Copy1Click(Sender: TObject); private { Private declarations } procedure DoJMKeyUp(Sender:TObject; var Key:word;Shift:TShiftState); procedure DoJMMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); procedure DisplayInfo; public --- 26,58 ---- Edit3: TEdit; udColumns: TUpDown; ! cbColor: TJvColorComboBox; ! cbFont: TJvFontComboBox; ! chkUnicode: TCheckBox; ! reInfo: TRichEdit; PopupMenu1: TPopupMenu; Copy1: TMenuItem; + btnSelect: TButton; procedure FormCreate(Sender: TObject); ! procedure btnFontClick(Sender: TObject); ! procedure chkZoomPanelClick(Sender: TObject); procedure udStartClick(Sender: TObject; Button: TUDBtnType); procedure udEndClick(Sender: TObject; Button: TUDBtnType); procedure udColumnsClick(Sender: TObject; Button: TUDBtnType); ! procedure chkUnicodeClick(Sender: TObject); procedure Copy1Click(Sender: TObject); + procedure btnSelectClick(Sender: TObject); + procedure cbColorChange(Sender: TObject); + procedure cbFontChange(Sender: TObject); private { Private declarations } + {$IFDEF USETNT} + edCharacter:TTntEdit; + {$ELSE} + edCharacter:TEdit; + {$ENDIF} procedure DoJMKeyUp(Sender:TObject; var Key:word;Shift:TShiftState); procedure DoJMMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); + procedure DoJMMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); procedure DisplayInfo; public *************** *** 57,61 **** implementation uses ! Clipbrd; {$R *.dfm} --- 68,76 ---- implementation uses ! {$IFDEF USETNT} ! TntClipbrd; ! {$ELSE} ! ClipBrd; ! {$ENDIF} {$R *.dfm} *************** *** 69,73 **** JM.OnKeyUp := DoJMKeyUp; JM.OnMouseUp := DoJMMouseUp; ! JM.ClientWidth := JM.CellSize.cx * JM.Columns + JM.Columns; JM.Left := (ClientWidth - JM.Width) div 2; --- 84,89 ---- JM.OnKeyUp := DoJMKeyUp; JM.OnMouseUp := DoJMMouseUp; ! JM.OnMouseWheel := DoJMMouseWheel; ! JM.ClientWidth := JM.CellSize.cx * JM.Columns + JM.Columns; JM.Left := (ClientWidth - JM.Width) div 2; *************** *** 77,89 **** // JM.AutoSizeColumns := true; JM.PopupMenu := PopupMenu1; ! CheckBox1.Checked := JM.ShowZoomPanel; udStart.Position := JM.StartChar; udEnd.Position := JM.EndChar; udColumns.Position := JM.Columns; ! JvColorComboBox1.ColorValue := JM.Color; ! JvFontComboBox1.Fontname := JM.Font.Name; end; ! procedure TForm1.Button2Click(Sender: TObject); begin FontDialog1.Font := JM.Font; --- 93,117 ---- // JM.AutoSizeColumns := true; JM.PopupMenu := PopupMenu1; ! chkZoomPanel.Checked := JM.ShowZoomPanel; udStart.Position := JM.StartChar; udEnd.Position := JM.EndChar; udColumns.Position := JM.Columns; ! cbColor.ColorValue := JM.Color; ! cbFont.Fontname := JM.Font.Name; ! {$IFDEF USETNT} ! edCharacter := TTntEdit.Create(self); ! {$ELSE} ! edCharacter := TEdit.Create(self); ! {$ENDIF} ! edCharacter.Parent := Panel1; ! edCharacter.Left := 312; ! edCharacter.Top := 16; ! edCharacter.Width := 121; ! edCharacter.Height := 22; ! edCharacter.TabOrder := 11; ! ActiveControl := JM; end; ! procedure TForm1.btnFontClick(Sender: TObject); begin FontDialog1.Font := JM.Font; *************** *** 91,101 **** begin JM.Font := FontDialog1.Font; ! JvFontComboBox1.Fontname := JM.Font.Name; end; end; ! procedure TForm1.CheckBox1Click(Sender: TObject); begin ! JM.ShowZoomPanel := CheckBox1.Checked; end; --- 119,129 ---- begin JM.Font := FontDialog1.Font; ! cbFont.Fontname := JM.Font.Name; end; end; ! procedure TForm1.chkZoomPanelClick(Sender: TObject); begin ! JM.ShowZoomPanel := chkZoomPanel.Checked; end; *************** *** 118,122 **** procedure TForm1.udEndClick(Sender: TObject; Button: TUDBtnType); begin ! JM.EndChar := udEnd.Position; end; --- 146,151 ---- procedure TForm1.udEndClick(Sender: TObject; Button: TUDBtnType); begin ! if not chkUnicode.Checked then ! JM.EndChar := udEnd.Position; end; *************** *** 223,243 **** procedure TForm1.DisplayInfo; begin ! RichEdit1.Clear; ! RichEdit1.Lines.Add('Character Type: ' + GetTypeString1(JM.Character)); ! RichEdit1.Lines.Add('Bidirectional Layout: ' + GetTypeString2(JM.Character)); ! RichEdit1.Lines.Add('Text Processing:' + GetTypeString3(JM.Character)); ! RichEdit1.Lines.Add(Format('Keyboard Code: U+%.4x',[Ord(JM.Character)])); ! end; ! ! procedure TForm1.JvFontComboBox1Change(Sender: TObject); ! begin ! if JM <> nil then ! JM.Font.Name := JvFontComboBox1.FontName; ! end; ! ! procedure TForm1.JvColorComboBox1Change(Sender: TObject); ! begin ! if JM <> nil then ! JM.Color := JvColorComboBox1.ColorValue; end; --- 252,261 ---- procedure TForm1.DisplayInfo; begin ! reInfo.Clear; ! reInfo.Lines.Add('Character Type: ' + GetTypeString1(JM.Character)); ! reInfo.Lines.Add('Bidirectional Layout: ' + GetTypeString2(JM.Character)); ! reInfo.Lines.Add('Text Processing:' + GetTypeString3(JM.Character)); ! reInfo.Lines.Add(Format('Keyboard Code: U+%.4x',[Ord(JM.Character)])); ! reInfo.Hint := trim(reInfo.Lines.Text); end; *************** *** 245,257 **** begin inherited; ! JvFontComboBox1.FontName := JM.Font.Name; ! JvColorComboBox1.ColorValue := JM.Color; ! JvColorComboBox1.OnChange := JvColorComboBox1Change; ! JvFontComboBox1.OnChange := JvFontComboBox1Change; end; ! procedure TForm1.CheckBox2Click(Sender: TObject); begin ! if CheckBox2.Checked then JM.EndChar := $FEFF else --- 263,275 ---- begin inherited; ! cbFont.FontName := JM.Font.Name; ! cbColor.ColorValue := JM.Color; ! cbColor.OnChange := cbColorChange; ! cbFont.OnChange := cbFontChange; end; ! procedure TForm1.chkUnicodeClick(Sender: TObject); begin ! if chkUnicode.Checked then JM.EndChar := $FEFF else *************** *** 261,265 **** --- 279,310 ---- procedure TForm1.Copy1Click(Sender: TObject); begin + {$IFDEF USETNT} + TntClipboard.AsWideText := JM.Character; + {$ELSE} Clipboard.AsText := WideString(JM.Character); + {$ENDIF} + end; + + procedure TForm1.DoJMMouseWheel(Sender: TObject; Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); + begin + DisplayInfo; + end; + + procedure TForm1.btnSelectClick(Sender: TObject); + begin + edCharacter.Text := edCharacter.Text + JM.Character; + end; + + procedure TForm1.cbColorChange(Sender: TObject); + begin + if JM <> nil then + JM.Color := cbColor.ColorValue; + end; + + procedure TForm1.cbFontChange(Sender: TObject); + begin + if JM <> nil then + JM.Font.Name := cbFont.FontName; end; |