summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-04-07 15:24:10 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-04-07 15:24:10 +0200
commit8e8285d4b12e2c975a0ccae747a2434fb5b66cd7 (patch)
tree7a0d9e80e52ddf5d788aed3262f88ab96fa5e26f /src
parent5d544b93ecceb437bf171ef21ec2c33dca24c03c (diff)
downloadfpGUI-8e8285d4b12e2c975a0ccae747a2434fb5b66cd7.tar.xz
Added 'Insert from Character Map' menu item for default popup menu in TfpgEdit
Text can now be inserted into a TfpgEdit via the Character Map dialog.
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_edit.pas32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/gui/fpg_edit.pas b/src/gui/fpg_edit.pas
index ba5f16c2..86ae00fc 100644
--- a/src/gui/fpg_edit.pas
+++ b/src/gui/fpg_edit.pas
@@ -77,6 +77,7 @@ type
procedure DefaultPopupCopy(Sender: TObject);
procedure DefaultPopupPaste(Sender: TObject);
procedure DefaultPopupClearAll(Sender: TObject);
+ procedure DefaultPopupInsertFromCharmap(Sender: TObject);
procedure SetDefaultPopupMenuItemsState;
procedure SetReadOnly(const AValue: Boolean);
protected
@@ -362,7 +363,8 @@ implementation
uses
fpg_stringutils,
- fpg_constants;
+ fpg_constants,
+ fpg_dialogs;
const
// internal popupmenu item names
@@ -370,6 +372,7 @@ const
ipmCopy = 'miDefaultCopy';
ipmPaste = 'miDefaultPaste';
ipmClearAll = 'miDefaultClearAll';
+ ipmCharmap = 'miDefaultCharmap';
function CreateEdit(AOwner: TComponent; x, y, w, h: TfpgCoord): TfpgEdit;
@@ -1154,26 +1157,43 @@ end;
procedure TfpgBaseEdit.DefaultPopupCut(Sender: TObject);
begin
+ if ReadOnly then
+ Exit;
CutToClipboard;
end;
procedure TfpgBaseEdit.DefaultPopupCopy(Sender: TObject);
begin
+ if ReadOnly then
+ Exit;
CopyToClipboard;
end;
procedure TfpgBaseEdit.DefaultPopupPaste(Sender: TObject);
begin
+ if ReadOnly then
+ Exit;
PasteFromClipboard
end;
procedure TfpgBaseEdit.DefaultPopupClearAll(Sender: TObject);
begin
if ReadOnly then
- Exit; //==>
+ Exit;
Clear;
end;
+procedure TfpgBaseEdit.DefaultPopupInsertFromCharmap(Sender: TObject);
+var
+ s: TfpgString;
+begin
+ if ReadOnly then
+ Exit;
+ s := fpgShowCharMap;
+ if s <> '' then
+ DoPaste(s);
+end;
+
procedure TfpgBaseEdit.SetDefaultPopupMenuItemsState;
var
i: integer;
@@ -1192,7 +1212,9 @@ begin
else if itm.Name = ipmPaste then
itm.Enabled := (not ReadOnly) and (fpgClipboard.Text <> '')
else if itm.Name = ipmClearAll then
- itm.Enabled := (not ReadOnly) and (Text <> '');
+ itm.Enabled := (not ReadOnly) and (Text <> '')
+ else if itm.Name = ipmCharmap then
+ itm.Enabled := (not ReadOnly);
end;
end;
end;
@@ -1230,6 +1252,10 @@ begin
itm.Name := ipmPaste;
itm := FDefaultPopupMenu.AddMenuItem(rsDelete, '', @DefaultPopupClearAll);
itm.Name := ipmClearAll;
+ itm := FDefaultPopupMenu.AddMenuItem('-', '', nil);
+ itm.Name := 'N1';
+ itm := FDefaultPopupMenu.AddMenuItem(rsInsertFromCharacterMap, '', @DefaultPopupInsertFromCharmap);
+ itm.Name := ipmCharmap;
end;
SetDefaultPopupMenuItemsState;