OSDN Git Service

実行に問題が生じていた 細かい使い心地に関する修正
authoryamat0jp <yamat0jp@yahoo.co.jp>
Sat, 25 Sep 2021 22:18:29 +0000 (07:18 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Sat, 25 Sep 2021 22:18:29 +0000 (07:18 +0900)
Unit1.dfm
Unit1.pas

index 00c98db..648f5b2 100644 (file)
--- a/Unit1.dfm
+++ b/Unit1.dfm
@@ -25,6 +25,7 @@ object Form1: TForm1
     Align = alClient
     PopupMenu = PopupMenu1
     TabOrder = 0
+    WantTabs = True
     OnChange = Memo1Change
     OnKeyDown = Memo1KeyDown
     OnKeyPress = Memo1KeyPress
@@ -56,7 +57,7 @@ object Form1: TForm1
     object ToolButton2: TToolButton
       Left = 25
       Top = 0
-      Hint = 'Exequte'
+      Hint = 'Execute'
       Caption = 'ToolButton2'
       ImageIndex = 0
       OnClick = ToolButton2Click
@@ -73,6 +74,7 @@ object Form1: TForm1
       Left = 56
       Top = 0
       Action = Action3
+      Enabled = False
       ImageIndex = 4
     end
     object ToolButton10: TToolButton
@@ -133,6 +135,7 @@ object Form1: TForm1
     Indent = 19
     ReadOnly = True
     TabOrder = 2
+    TabStop = False
     Items.NodeData = {
       0301000000320000000000000000000000FFFFFFFFFFFFFFFF00000000000000
       0000000000010A4A0053004F004E0020006900740065006D007300}
@@ -166,6 +169,7 @@ object Form1: TForm1
       Top = 39
       Width = 892
       Height = 108
+      TabStop = False
       Align = alClient
       Lines.Strings = (
         '')
@@ -217,7 +221,7 @@ object Form1: TForm1
     Left = 200
     Top = 88
     Bitmap = {
-      494C0101060008008C0010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
+      494C010106000800940010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
       0000000000003600000028000000400000002000000001002000000000000020
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000000000000000000000000000000000
@@ -512,7 +516,9 @@ object Form1: TForm1
       ShortCut = 16449
     end
     object Action1: TAction
+      Category = #12501#12449#12452#12523
       Caption = #23455#34892
+      ShortCut = 16453
       OnExecute = ToolButton2Click
     end
     object Action2: TAction
@@ -524,6 +530,7 @@ object Form1: TForm1
       Caption = #32066#20102'(&X)'
       Hint = #32066#20102'|'#12450#12503#12522#12465#12540#12471#12519#12531#12434#32066#20102#12375#12414#12377
       ImageIndex = 43
+      ShortCut = 16465
     end
     object Action3: TAction
       Category = #32232#38598
@@ -540,6 +547,7 @@ object Form1: TForm1
     object Action5: TAction
       Category = #32232#38598
       Caption = 'ReDo'
+      ShortCut = 16466
       OnExecute = Action5Execute
     end
   end
index a79a642..ebba2d2 100644 (file)
--- a/Unit1.pas
+++ b/Unit1.pas
@@ -78,6 +78,7 @@ type
     procedure Action5Execute(Sender: TObject);
   private
     { Private \90é\8c¾ }
+    function checkplane: Boolean;
     procedure loop(item: TTreeNode; JSON: TJSONObject);
     procedure arrloop(item: TTreeNode; arr: TJSONArray);
     function returnChar(c: TIndxChar): Char;
@@ -105,6 +106,7 @@ var
 procedure TForm1.Action3Execute(Sender: TObject);
 begin
   Undo.Execute;
+  ToolButton8.Enabled := Undo.CanUndo;
   ToolButton11.Enabled := Undo.CanRedo;
 end;
 
@@ -123,6 +125,7 @@ end;
 procedure TForm1.Action5Execute(Sender: TObject);
 begin
   Undo.ReDo;
+  ToolButton8.Enabled := Undo.CanUndo;
   ToolButton11.Enabled := Undo.CanRedo;
 end;
 
@@ -153,6 +156,28 @@ begin
   end;
 end;
 
+function TForm1.checkplane: Boolean;
+var
+  i: integer;
+  s: string;
+  j: integer;
+begin
+  result := true;
+  if Memo1.Text <> '' then
+    for i := 0 to Memo1.Lines.count - 1 do
+    begin
+      s := Memo1.Lines[i];
+      for j := 1 to Length(s) do
+        case s[j] of
+          Char(VK_SPACE), Char(VK_TAB), '\81@':
+            continue;
+        else
+          result := false;
+          break;
+        end;
+    end;
+end;
+
 procedure TForm1.FormCreate(Sender: TObject);
 begin
   TabControl1Change(nil);
@@ -241,23 +266,23 @@ begin
   if Memo1.Text <> '' then
     case Key of
       VK_DELETE:
-      begin
-        if Memo1.CaretPos.X = Length(Memo1.Lines[Memo1.CaretPos.Y]) then
         begin
-          Undo.DelReturn(Memo1.SelStart,true);
-          Undo.ResetDel;
+          if Memo1.CaretPos.X = Length(Memo1.Lines[Memo1.CaretPos.Y]) then
+          begin
+            Undo.DelReturn(Memo1.SelStart, true);
+            Undo.ResetDel;
+            Undo.ResetBack;
+            charmodi := true;
+            Exit;
+          end
+          else if Memo1.SelLength = 0 then
+            delstr := Memo1.Text[Memo1.SelStart + 1]
+          else
+            delstr := Memo1.SelText;
           Undo.ResetBack;
-          charmodi := true;
-          Exit;
-        end
-        else if Memo1.SelLength = 0 then
-          delstr := Memo1.Text[Memo1.SelStart + 1]
-        else
-          delstr := Memo1.SelText;
-        Undo.ResetBack;
-        Undo.Deleted(delstr, Memo1.SelStart, true);
-        Undo.UpDelCnt;
-      end;
+          Undo.Deleted(delstr, Memo1.SelStart, true);
+          Undo.UpDelCnt;
+        end;
     end;
   charmodi := true;
 end;
@@ -272,7 +297,7 @@ begin
       begin
         if Memo1.CaretPos.X = 0 then
         begin
-          Undo.DelReturn(Memo1.SelStart,false);
+          Undo.DelReturn(Memo1.SelStart, false);
           Undo.ResetDel;
           Undo.ResetBack;
           charmodi := true;
@@ -281,12 +306,12 @@ begin
         else if Memo1.SelLength = 0 then
         begin
           delstr := Memo1.Text[Memo1.SelStart];
-          i:=Memo1.SelStart-1;
+          i := Memo1.SelStart - 1;
         end
         else
         begin
           delstr := Memo1.SelText;
-          i:=Memo1.SelStart;
+          i := Memo1.SelStart;
         end;
         Undo.ResetDel;
         Undo.Deleted(delstr, i, false);
@@ -353,19 +378,25 @@ var
 begin
   id := Low(id);
   TreeView1.Items.Clear;
-  if Memo1.Text = '' then
-    Memo1.Text := Clipboard.AsText;
+  if checkplane = true then
+  begin
+    Memo1.Text := '';
+    Action4Execute(nil);
+    Memo1.SelLength := 0;
+  end;
   j := TJSONObject.ParseJSONValue(Memo1.Text) as TJSONObject;
   if j <> nil then
-    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 := '';
+    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;