From 8883209a1ad1a5d6c31f231cf91b95e5b5d3612d Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sun, 2 Sep 2012 21:48:29 -0400 Subject: [PATCH] Menu command copy/paste fix --- mystic/bbs_cfg_menuedit.pas | 2 +- mystic/bbs_menudata.pas | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/mystic/bbs_cfg_menuedit.pas b/mystic/bbs_cfg_menuedit.pas index a64ea68..44ceea6 100644 --- a/mystic/bbs_cfg_menuedit.pas +++ b/mystic/bbs_cfg_menuedit.pas @@ -532,7 +532,7 @@ Begin Case List.ExitCode of '/' : Case GetCommandOption(10, 'F-Flags|I-Insert|D-Delete|C-Copy|P-Paste|V-View|') of 'I' : Begin - Menu.InsertItem(List.Picked); + Menu.InsertItem(List.Picked, True); Changed := True; End; 'C' : If List.Picked <> List.ListMax Then diff --git a/mystic/bbs_menudata.pas b/mystic/bbs_menudata.pas index c973004..a50abfe 100644 --- a/mystic/bbs_menudata.pas +++ b/mystic/bbs_menudata.pas @@ -22,7 +22,7 @@ Type Function Load (Append: Boolean; FN: String) : Boolean; Function Save (FN: String) : Boolean; Procedure Unload; - Procedure InsertItem (Num: Word); + Procedure InsertItem (Num: Word; Cmd: Boolean); Procedure DeleteItem (Num: Word); Procedure CopyItem (Source, Dest: Word); Procedure InsertCommand (Num, CmdNum: Word); @@ -291,7 +291,7 @@ Begin End; End; -Procedure TMenuData.InsertItem (Num: Word); +Procedure TMenuData.InsertItem (Num: Word; Cmd: Boolean); Var Count : Word; Begin @@ -314,7 +314,7 @@ Begin Redraw := 1; End; - InsertCommand(Num, 1); + If Cmd Then InsertCommand(Num, 1); End; Function TMenuData.CreateNewMenu (FN: String) : Boolean; @@ -324,31 +324,29 @@ Begin Info.Footer := '|CR|09Selection|03: |11'; Info.DispCols := 3; - InsertItem(1); + InsertItem(1, True); Result := Save(FN); End; Procedure TMenuData.CopyItem (Source, Dest: Word); Var - Count : Word; + MI : RecMenuItem; + Count : SmallInt; Begin If NumItems = mysMaxMenuItems Then Exit; - Inc (NumItems); + MI := Item[Source]^; - For Count := NumItems DownTo Dest + 1 Do - Item[Count] := Item[Count - 1]; + For Count := 1 to MI.Commands Do Begin + New (MI.CmdData[Count]); - New (Item[Dest]); - - 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]^; + MI.CmdData[Count]^ := Item[Source]^.CmdData[Count]^; End; + + InsertItem(Dest, False); + + Item[Dest]^ := MI; End; End.