(p *tree.Plan)
| 532 | } |
| 533 | |
| 534 | func (dv *DiffEditor) MakeToolbar(p *tree.Plan) { |
| 535 | txta := "A: " + fsx.DirAndFile(dv.FileA) |
| 536 | if dv.RevisionA != "" { |
| 537 | txta += ": " + dv.RevisionA |
| 538 | } |
| 539 | tree.Add(p, func(w *core.Text) { |
| 540 | w.SetText(txta) |
| 541 | }) |
| 542 | tree.Add(p, func(w *core.Button) { |
| 543 | w.SetText("Next").SetIcon(icons.KeyboardArrowDown).SetTooltip("move down to next diff region") |
| 544 | w.OnClick(func(e events.Event) { |
| 545 | dv.nextDiff(0) |
| 546 | }) |
| 547 | w.Styler(func(s *styles.Style) { |
| 548 | s.SetState(len(dv.alignD) <= 1, states.Disabled) |
| 549 | }) |
| 550 | }) |
| 551 | tree.Add(p, func(w *core.Button) { |
| 552 | w.SetText("Prev").SetIcon(icons.KeyboardArrowUp).SetTooltip("move up to previous diff region") |
| 553 | w.OnClick(func(e events.Event) { |
| 554 | dv.prevDiff(0) |
| 555 | }) |
| 556 | w.Styler(func(s *styles.Style) { |
| 557 | s.SetState(len(dv.alignD) <= 1, states.Disabled) |
| 558 | }) |
| 559 | }) |
| 560 | tree.Add(p, func(w *core.Button) { |
| 561 | w.SetText("A <- B").SetIcon(icons.ContentCopy).SetTooltip("for current diff region, apply change from corresponding version in B, and move to next diff") |
| 562 | w.OnClick(func(e events.Event) { |
| 563 | dv.applyDiff(0, -1) |
| 564 | dv.nextDiff(0) |
| 565 | }) |
| 566 | w.Styler(func(s *styles.Style) { |
| 567 | s.SetState(len(dv.alignD) <= 1, states.Disabled) |
| 568 | }) |
| 569 | }) |
| 570 | tree.Add(p, func(w *core.Button) { |
| 571 | w.SetText("Undo").SetIcon(icons.Undo).SetTooltip("undo last diff apply action (A <- B)") |
| 572 | w.OnClick(func(e events.Event) { |
| 573 | dv.undoDiff(0) |
| 574 | }) |
| 575 | w.Styler(func(s *styles.Style) { |
| 576 | s.SetState(!dv.bufferA.IsNotSaved(), states.Disabled) |
| 577 | }) |
| 578 | }) |
| 579 | tree.Add(p, func(w *core.Button) { |
| 580 | w.SetText("Save").SetIcon(icons.Save).SetTooltip("save edited version of file with the given; prompts for filename") |
| 581 | w.OnClick(func(e events.Event) { |
| 582 | fb := core.NewSoloFuncButton(w).SetFunc(dv.saveFileA) |
| 583 | fb.Args[0].SetValue(core.Filename(dv.FileA)) |
| 584 | fb.CallFunc() |
| 585 | }) |
| 586 | w.Styler(func(s *styles.Style) { |
| 587 | s.SetState(!dv.bufferA.IsNotSaved(), states.Disabled) |
| 588 | }) |
| 589 | }) |
| 590 | |
| 591 | tree.Add(p, func(w *core.Separator) {}) |
nothing calls this directly
no test coverage detected