Menu command copy/paste fix

This commit is contained in:
mysticbbs 2012-09-02 21:48:29 -04:00
parent 4253931b5b
commit 8883209a1a
2 changed files with 15 additions and 17 deletions

View File

@ -532,7 +532,7 @@ Begin
Case List.ExitCode of Case List.ExitCode of
'/' : Case GetCommandOption(10, 'F-Flags|I-Insert|D-Delete|C-Copy|P-Paste|V-View|') of '/' : Case GetCommandOption(10, 'F-Flags|I-Insert|D-Delete|C-Copy|P-Paste|V-View|') of
'I' : Begin 'I' : Begin
Menu.InsertItem(List.Picked); Menu.InsertItem(List.Picked, True);
Changed := True; Changed := True;
End; End;
'C' : If List.Picked <> List.ListMax Then 'C' : If List.Picked <> List.ListMax Then

View File

@ -22,7 +22,7 @@ Type
Function Load (Append: Boolean; FN: String) : Boolean; Function Load (Append: Boolean; FN: String) : Boolean;
Function Save (FN: String) : Boolean; Function Save (FN: String) : Boolean;
Procedure Unload; Procedure Unload;
Procedure InsertItem (Num: Word); Procedure InsertItem (Num: Word; Cmd: Boolean);
Procedure DeleteItem (Num: Word); Procedure DeleteItem (Num: Word);
Procedure CopyItem (Source, Dest: Word); Procedure CopyItem (Source, Dest: Word);
Procedure InsertCommand (Num, CmdNum: Word); Procedure InsertCommand (Num, CmdNum: Word);
@ -291,7 +291,7 @@ Begin
End; End;
End; End;
Procedure TMenuData.InsertItem (Num: Word); Procedure TMenuData.InsertItem (Num: Word; Cmd: Boolean);
Var Var
Count : Word; Count : Word;
Begin Begin
@ -314,7 +314,7 @@ Begin
Redraw := 1; Redraw := 1;
End; End;
InsertCommand(Num, 1); If Cmd Then InsertCommand(Num, 1);
End; End;
Function TMenuData.CreateNewMenu (FN: String) : Boolean; Function TMenuData.CreateNewMenu (FN: String) : Boolean;
@ -324,31 +324,29 @@ Begin
Info.Footer := '|CR|09Selection|03: |11'; Info.Footer := '|CR|09Selection|03: |11';
Info.DispCols := 3; Info.DispCols := 3;
InsertItem(1); InsertItem(1, True);
Result := Save(FN); Result := Save(FN);
End; End;
Procedure TMenuData.CopyItem (Source, Dest: Word); Procedure TMenuData.CopyItem (Source, Dest: Word);
Var Var
Count : Word; MI : RecMenuItem;
Count : SmallInt;
Begin Begin
If NumItems = mysMaxMenuItems Then Exit; If NumItems = mysMaxMenuItems Then Exit;
Inc (NumItems); MI := Item[Source]^;
For Count := NumItems DownTo Dest + 1 Do For Count := 1 to MI.Commands Do Begin
Item[Count] := Item[Count - 1]; New (MI.CmdData[Count]);
New (Item[Dest]); MI.CmdData[Count]^ := Item[Source]^.CmdData[Count]^;
Item[Dest]^ := Item[Source]^;
For Count := 1 to Item[Source]^.Commands Do Begin
New (Item[Dest]^.CmdData[Count]);
Item[Dest]^.CmdData[Count]^ := Item[Source]^.CmdData[Count]^;
End; End;
InsertItem(Dest, False);
Item[Dest]^ := MI;
End; End;
End. End.