View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0005131 | JEDI VCL | 00 JVCL Components | public | 2010-01-24 20:44 | 2011-06-10 16:09 |
| Reporter | debose | Assigned To | obones | ||
| Priority | normal | Severity | tweak | Reproducibility | N/A |
| Status | resolved | Resolution | fixed | ||
| Product Version | Daily / GIT | ||||
| Target Version | 3.40 | Fixed in Version | 3.40 | ||
| Summary | 0005131: JvRichEdit demo update. | ||||
| Description | 1) underline button functionality enhanced by adding popup menu with underline styles. 2) added "Export to html.." menu item, to export RichEdit via JvRichEditToHtml component. | ||||
| Additional Information | only new thing I'm not sure about is PromptForFileName function from Dialogs.pas. I checked it exist in D2010 and D7, but don't know how with D5 and D6. | ||||
| Tags | demo, examples, jvRichEdit | ||||
|
2010-01-24 20:44
|
JvRichEditDemo.patch (4,551 bytes)
Index: EditorMainFormU.dfm
===================================================================
--- EditorMainFormU.dfm (revision 12678)
+++ EditorMainFormU.dfm (working copy)
@@ -362,8 +362,10 @@
AllowAllUp = True
Caption = 'Underline'
GroupIndex = 7
+ DropDownMenu = UnderlineStyle
Hint = 'Underline'
ImageIndex = 15
+ MarkDropDown = False
Spacing = 1
Left = 276
Top = 5
@@ -532,6 +534,11 @@
Caption = 'Save Selec&ted...'
OnClick = FileSaveSelected
end
+ object ExportToHtmlItem: TMenuItem
+ Tag = -1
+ Caption = 'Export to HTML...'
+ OnClick = ExportToHtmlItemClick
+ end
object N1: TMenuItem
Tag = -1
Caption = '-'
@@ -1873,4 +1880,20 @@
Left = 120
Top = 128
end
+ object UnderlineStyle: TJvPopupMenu
+ OnPopup = UnderlineStylePopup
+ Style = msXP
+ ImageMargin.Left = 0
+ ImageMargin.Top = 0
+ ImageMargin.Right = 0
+ ImageMargin.Bottom = 0
+ ImageSize.Height = 16
+ ImageSize.Width = 16
+ Left = 148
+ Top = 128
+ end
+ object JvRichEditToHtml1: TJvRichEditToHtml
+ Left = 176
+ Top = 128
+ end
end
Index: EditorMainFormU.pas
===================================================================
--- EditorMainFormU.pas (revision 12678)
+++ EditorMainFormU.pas (working copy)
@@ -33,7 +33,9 @@
ImgList, Controls, Menus, JvMenus, ComCtrls, ExtCtrls, Classes, ActiveX,
JvComponent, JvAppEvent, JvMaskEdit, JvSpin, JvCombobox, JvColorCombo,
JvSpeedBar, JvRichEdit, JvClipboardMonitor, JvExMask, JvExStdCtrls,
- JvExExtCtrls, XPColorMenuItemPainter;
+ JvExExtCtrls, XPColorMenuItemPainter,
+ JvComponentBase, JvExtComponent,
+ JvRichEditToHtml, JvDialogs;
type
TEditorMainForm = class(TForm)
@@ -118,6 +120,9 @@
App: TJvAppEvents;
FormatTabsItem: TMenuItem;
JustifyBtn: TJvSpeedItem;
+ UnderlineStyle: TJvPopupMenu;
+ JvRichEditToHtml1: TJvRichEditToHtml;
+ ExportToHtmlItem: TMenuItem;
procedure SelectionChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ShowHint(Sender: TObject);
@@ -192,6 +197,8 @@
procedure EditorGetDragDropEffect(Sender: TObject;
ShiftState: TShiftState; var AllowedEffects: TRichDropEffects;
var Handled: Boolean);
+ procedure ExportToHtmlItemClick(Sender: TObject);
+ procedure UnderlineStylePopup(Sender: TObject);
private
FFileName: string;
FUpdating: Boolean;
@@ -254,6 +261,10 @@
clSilver, clRed, clLime, clYellow, clBlue, clFuchsia, clAqua, clWhite,
clWindow);
+ UnderlineTypes: array[TUnderlineType] of string =
+ ('None', 'Solid', 'Word', 'Double', 'Dotted', 'Dash',
+ 'DashDot', 'DashDotDot', 'Wave', 'Thick');
+
function ColorName(Color: TColor): string;
begin
if (Color = clWindowText) or (Color = clWindow) or (Color = clDefault) then
@@ -699,6 +710,19 @@
Add(Item);
end;
end;
+ with UnderlineStyle.Items do
+ begin
+ while Count > 0 do
+ Items[Count - 1].Free;
+ for I := 0 to 9 do
+ begin
+ Item := NewItem(UnderlineTypes[TUnderlineType(I)], scNone,
+ False, True, UnderlineButtonClick, 0, '');
+ Item.RadioItem := True;
+ Item.Tag := I;
+ Add(Item);
+ end;
+ end;
FClipboardMonitor := TJvClipboardMonitor.Create(Self);
FClipboardMonitor.OnChange := ClipboardChanged;
SuperscriptBtn.Enabled := RichEditVersion >= 2;
@@ -1084,6 +1108,11 @@
begin
if FUpdating then
Exit;
+ if Sender is TMenuItem then
+ begin
+ CurrText.UnderlineType := TUnderlineType(TMenuItem(Sender).Tag);
+ end
+ else
if UnderlineBtn.Down then
CurrText.Style := CurrText.Style + [fsUnderline]
else
@@ -1238,4 +1267,30 @@
Handled := True;
end;
+procedure TEditorMainForm.ExportToHtmlItemClick(Sender: TObject);
+const
+ cHtmlExportFilter = 'HTML documents|*.HTML;*.HTM';
+ cHtmlExportTitle = 'Where to save exported HTML?';
+ cHtmlExportExt = 'HTML';
+var
+ tmpHtmlFilename: string;
+begin
+ if PromptForFileName(tmpHtmlFilename, cHtmlExportFilter,cHtmlExportExt,cHtmlExportTitle,
+ '',True) then
+ begin
+ JvRichEditToHtml1.ConvertToHtml(self.Editor, tmpHtmlFilename);
+ RichEditChange(nil);
+ end;
+end;
+
+procedure TEditorMainForm.UnderlineStylePopup(Sender: TObject);
+var
+ I: Integer;
+ UT: TUnderlineType;
+begin
+ UT := CurrText.UnderlineType;
+ for I := 0 to 9 do
+ UnderlineStyle.Items[I].Checked := (UT = TUnderlineType(i) );
+end;
+
end.
|
|
|
Thanks, this is now in SVN |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-01-24 20:44 | debose | New Issue | |
| 2010-01-24 20:44 | debose | File Added: JvRichEditDemo.patch | |
| 2010-01-24 22:19 | debose | Tag Attached: demo | |
| 2010-01-24 22:19 | debose | Tag Attached: examples | |
| 2010-01-24 22:20 | debose | Tag Attached: jvRichEdit | |
| 2010-03-08 16:02 | obones | Note Added: 0017248 | |
| 2010-03-08 16:02 | obones | Assigned To | => obones |
| 2010-03-08 16:02 | obones | Status | new => resolved |
| 2010-03-08 16:02 | obones | Resolution | open => fixed |
| 2010-03-08 16:02 | obones | Fixed in Version | => Daily / SVN |
| 2010-03-08 16:02 | obones | Target Version | => 3.40 - not yet released |
| 2011-06-10 16:09 | obones | Fixed in Version | Daily / SVN => 3.40 |