Height = 287
Align = alClient
PopupMenu = PopupMenu1
+ ScrollBars = ssVertical
TabOrder = 0
WantTabs = True
OnChange = Memo1Change
object ToolButton2: TToolButton
Left = 25
Top = 0
- Hint = 'Execute'
- Caption = 'ToolButton2'
+ Action = Execute1
ImageIndex = 0
- OnClick = ToolButton2Click
end
object ToolButton9: TToolButton
Left = 48
object ToolButton8: TToolButton
Left = 56
Top = 0
- Hint = 'Undo'
- Action = Action3
+ Action = Undo1
Enabled = False
ImageIndex = 4
end
object ToolButton11: TToolButton
Left = 87
Top = 0
- Hint = 'Redo'
- Action = Action5
+ Action = Redo
Enabled = False
ImageIndex = 1
end
Left = 200
Top = 88
Bitmap = {
- 494C010106000800980010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
+ 494C010106000800A00010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000002000000001002000000000000020
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
Hint = #12377#12409#12390#36984#25246'|'#12489#12461#12517#12513#12531#12488#20840#20307#12434#36984#25246#12375#12414#12377
ShortCut = 16449
end
- object Action1: TAction
+ object Execute1: TAction
Category = #12501#12449#12452#12523
Caption = #23455#34892
+ Hint = 'Execute'
ShortCut = 16453
- OnExecute = ToolButton2Click
+ OnExecute = Execute1Execute
end
- object Action2: TAction
- Caption = #12504#12523#12503
+ object Hint1: TAction
+ Caption = 'Help'
+ Hint = 'Hint'
+ ShortCut = 16456
OnExecute = ToolButton5Click
end
object FileExit1: TFileExit
ImageIndex = 43
ShortCut = 16465
end
- object Action3: TAction
+ object Undo1: TAction
Category = #32232#38598
Caption = 'Undo'
+ Hint = 'Undo'
ShortCut = 16474
- OnExecute = Action3Execute
+ OnExecute = Undo1Execute
end
- object Action4: TAction
+ object Past1: TAction
Category = #32232#38598
Caption = 'Past'
+ Hint = 'Past'
ShortCut = 16470
- OnExecute = Action4Execute
+ OnExecute = Past1Execute
end
- object Action5: TAction
+ object Redo: TAction
Category = #32232#38598
Caption = 'ReDo'
+ Hint = 'Redo'
ShortCut = 16466
- OnExecute = Action5Execute
+ OnExecute = RedoExecute
end
end
object PopupMenu1: TPopupMenu
Action = EditCut1
end
object P1: TMenuItem
- Action = Action4
+ Action = Past1
end
object A1: TMenuItem
Action = EditSelectAll1
end
object U1: TMenuItem
- Action = Action3
+ Action = Undo1
end
object ReDo1: TMenuItem
- Action = Action5
+ Action = Redo
end
end
object MainMenu1: TMainMenu
object N1: TMenuItem
Caption = #12501#12449#12452#12523
object N4: TMenuItem
- Action = Action1
+ Action = Execute1
end
object N5: TMenuItem
Caption = '-'
Action = EditCut1
end
object P2: TMenuItem
- Action = Action4
+ Action = Past1
end
object A2: TMenuItem
Action = EditSelectAll1
end
object U2: TMenuItem
- Action = Action3
+ Action = Undo1
end
- object ReDo2: TMenuItem
- Action = Action5
+ object R2: TMenuItem
+ Action = Redo
end
end
object N3: TMenuItem
Caption = #12504#12523#12503
object N6: TMenuItem
- Action = Action2
+ Action = Hint1
end
end
end
A1: TMenuItem;
U1: TMenuItem;
MainMenu1: TMainMenu;
- Action1: TAction;
- Action2: TAction;
+ Execute1: TAction;
+ Hint1: TAction;
TabControl1: TTabControl;
Memo3: TMemo;
Memo4: TMemo;
ToolButton9: TToolButton;
ToolButton10: TToolButton;
Memo5: TMemo;
- Action3: TAction;
- Action4: TAction;
- Action5: TAction;
+ Undo1: TAction;
+ Past1: TAction;
+ Redo: TAction;
ReDo1: TMenuItem;
- ReDo2: TMenuItem;
+ R2: TMenuItem;
ToolButton11: TToolButton;
- procedure ToolButton2Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure TabControl1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Memo1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure Memo1KeyPress(Sender: TObject; var Key: Char);
procedure FormDestroy(Sender: TObject);
- procedure Action3Execute(Sender: TObject);
+ procedure Undo1Execute(Sender: TObject);
procedure Memo1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
- procedure Action4Execute(Sender: TObject);
- procedure Action5Execute(Sender: TObject);
+ procedure Past1Execute(Sender: TObject);
+ procedure RedoExecute(Sender: TObject);
+ procedure Execute1Execute(Sender: TObject);
private
{ Private \90é\8c¾ }
function checkplane: Boolean;
charmodi: Boolean;
Undo: TUndoClass;
-procedure TForm1.Action3Execute(Sender: TObject);
+procedure TForm1.Undo1Execute(Sender: TObject);
begin
Undo.Execute;
ToolButton8.Enabled := Undo.CanUndo;
ToolButton11.Enabled := Undo.CanRedo;
end;
-procedure TForm1.Action4Execute(Sender: TObject);
+procedure TForm1.Past1Execute(Sender: TObject);
var
s: string;
begin
ToolButton8.Enabled := Undo.CanUndo;
end;
-procedure TForm1.Action5Execute(Sender: TObject);
+procedure TForm1.RedoExecute(Sender: TObject);
begin
Undo.ReDo;
ToolButton8.Enabled := Undo.CanUndo;
end;
end;
+procedure TForm1.Execute1Execute(Sender: TObject);
+var
+ i: integer;
+ j: TJSONObject;
+begin
+ id := Low(id);
+ TreeView1.Items.Clear;
+ if checkplane = true then
+ begin
+ Memo1.Text := '';
+ Past1Execute(nil);
+ Memo1.SelLength := 0;
+ end;
+ j := TJSONObject.ParseJSONValue(Memo1.Text) as TJSONObject;
+ if j <> nil then
+ begin
+ loop(nil, j);
+ for i := 0 to TreeView1.Items.count - 1 do
+ TreeView1.Items[i].Expanded := true;
+ if TreeView1.Items.count = 0 then
+ StatusBar1.Panels[0].Text := 'error'
+ else
+ begin
+ Clipboard.AsText := j.ToString;
+ StatusBar1.Panels[0].Text := '';
+ end;
+ end;
+end;
+
procedure TForm1.FormCreate(Sender: TObject);
begin
TabControl1Change(nil);
var
i: integer;
begin
- case Ord(Key) of
- VK_BACK:
- if Memo1.SelStart > 0 then
+ if Ord(Key) = VK_BACK then
+ begin
+ if Memo1.SelStart > 0 then
+ begin
+ if Memo1.CaretPos.X = 0 then
begin
- if Memo1.CaretPos.X = 0 then
- begin
- Undo.DelReturn(Memo1.SelStart, false);
- Undo.ResetDel;
- Undo.ResetBack;
- charmodi := true;
- Exit;
- end
- else if Memo1.SelLength = 0 then
- begin
- delstr := Memo1.Text[Memo1.SelStart];
- i := Memo1.SelStart - 1;
- end
- else
- begin
- delstr := Memo1.SelText;
- i := Memo1.SelStart;
- end;
+ Undo.DelReturn(Memo1.SelStart, false);
Undo.ResetDel;
- Undo.Deleted(delstr, i, false);
- Undo.UpBackCnt;
+ Undo.ResetBack;
+ charmodi := true;
+ Exit;
+ end
+ else if Memo1.SelLength = 0 then
+ begin
+ delstr := Memo1.Text[Memo1.SelStart];
+ i := Memo1.SelStart - 1;
+ end
+ else
+ begin
+ delstr := Memo1.SelText;
+ i := Memo1.SelStart;
end;
- VK_DELETE:
- ;
+ Undo.ResetDel;
+ Undo.Deleted(delstr, i, false);
+ Undo.UpBackCnt;
+ end;
+ end
else
- Undo.ResetDel;
- Undo.ResetBack;
- inputsub(Key);
- end;
- if Key = '.' then
begin
Undo.ResetDel;
Undo.ResetBack;
end;
end;
-procedure TForm1.ToolButton2Click(Sender: TObject);
-var
- i: integer;
- j: TJSONObject;
-begin
- id := Low(id);
- TreeView1.Items.Clear;
- if checkplane = true then
- begin
- Memo1.Text := '';
- Action4Execute(nil);
- Memo1.SelLength := 0;
- end;
- j := TJSONObject.ParseJSONValue(Memo1.Text) as TJSONObject;
- if j <> nil then
- begin
- loop(nil, j);
- for i := 0 to TreeView1.Items.count - 1 do
- TreeView1.Items[i].Expanded := true;
- if TreeView1.Items.count = 0 then
- StatusBar1.Panels[0].Text := 'error'
- else
- begin
- Clipboard.AsText := j.ToString;
- StatusBar1.Panels[0].Text := '';
- end;
- end;
-end;
-
procedure TForm1.ToolButton5Click(Sender: TObject);
begin
TabControl1.Visible := not TabControl1.Visible;