git-gui: Added context menus for consoles and commit message buffer.
This change adds a context menu to the commit message buffer providing fast access to the contents of the Edit menu, and to the console text buffer, providing easy ways to copy selections of the buffer or the entire buffer. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 11, 2006 at 20:24 UTC
0e794311833fd4d6f0c3204a5449372284318bda
1 file changed
+66
git-gui
+66
@@ -1301,6 +1301,21 @@ proc console_init {w} {
1301
pack $w.m.t -side left -fill both -expand 1
1302
pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
1303
1304
+ menu $w.ctxm -tearoff 0
1305
+ $w.ctxm add command -label "Copy" \
1306
+ -font $font_ui \
1307
+ -command "tk_textCopy $w.m.t"
1308
+ $w.ctxm add command -label "Select All" \
1309
+ -font $font_ui \
1310
+ -command "$w.m.t tag add sel 0.0 end"
1311
+ $w.ctxm add command -label "Copy All" \
1312
+ -font $font_ui \
1313
+ -command "
1314
+ $w.m.t tag add sel 0.0 end
1315
+ tk_textCopy $w.m.t
1316
+ $w.m.t tag remove sel 0.0 end
1317
+ "
1318
+
1319
button $w.ok -text {Running...} \
1320
-width 15 \
1321
-font $font_ui \
@@ -1308,6 +1323,7 @@ proc console_init {w} {
1323
-command "destroy $w"
1324
pack $w.ok -side bottom
1325
1326
+ bind $w.m.t <Any-Button-3> "tk_popup $w.ctxm %X %Y"
1327
bind $w.m.t <$M1B-Key-a> "$w.m.t tag add sel 0.0 end;break"
1328
bind $w.m.t <$M1B-Key-A> "$w.m.t tag add sel 0.0 end;break"
1329
bind $w <Visibility> "focus $w"
@@ -1784,6 +1800,38 @@ pack .vpane.lower.commarea.buffer.sby -side right -fill y
1800
pack $ui_comm -side left -fill y
1801
pack .vpane.lower.commarea.buffer -side left -fill y
1802
1803
+# -- Commit Message Buffer Context Menu
1804
+#
1805
+menu $ui_comm.ctxm -tearoff 0
1806
+$ui_comm.ctxm add command -label "Cut" \
1807
+ -font $font_ui \
1808
+ -command "tk_textCut $ui_comm"
1809
+$ui_comm.ctxm add command -label "Copy" \
1810
+ -font $font_ui \
1811
+ -command "tk_textCopy $ui_comm"
1812
+$ui_comm.ctxm add command -label "Paste" \
1813
+ -font $font_ui \
1814
+ -command "tk_textPaste $ui_comm"
1815
+$ui_comm.ctxm add command -label "Delete" \
1816
+ -font $font_ui \
1817
+ -command "$ui_comm delete sel.first sel.last"
1818
+$ui_comm.ctxm add separator
1819
+$ui_comm.ctxm add command -label "Select All" \
1820
+ -font $font_ui \
1821
+ -command "$ui_comm tag add sel 0.0 end"
1822
+$ui_comm.ctxm add command -label "Copy All" \
1823
+ -font $font_ui \
1824
+ -command "
1825
+ $ui_comm tag add sel 0.0 end
1826
+ tk_textCopy $ui_comm
1827
+ $ui_comm tag remove sel 0.0 end
1828
+ "
1829
+$ui_comm.ctxm add separator
1830
+$ui_comm.ctxm add command -label "Sign Off" \
1831
+ -font $font_ui \
1832
+ -command do_signoff
1833
+bind $ui_comm <Any-Button-3> "tk_popup $ui_comm.ctxm %X %Y"
1834
+
1835
# -- Diff Header
1836
set ui_fname_value {}
1837
set ui_fstatus_value {}
@@ -1837,6 +1885,24 @@ $ui_diff tag conf di -foreground "#00a000"
1885
$ui_diff tag conf dni -foreground "#a000a0"
1886
$ui_diff tag conf bold -font [concat $font_diff bold]
1887
1888
+# -- Diff Body Context Menu
1889
+#
1890
+menu $ui_diff.ctxm -tearoff 0
1891
+$ui_diff.ctxm add command -label "Copy" \
1892
+ -font $font_ui \
1893
+ -command "tk_textCopy $ui_diff"
1894
+$ui_diff.ctxm add command -label "Select All" \
1895
+ -font $font_ui \
1896
+ -command "$ui_diff tag add sel 0.0 end"
1897
+$ui_diff.ctxm add command -label "Copy All" \
1898
+ -font $font_ui \
1899
+ -command "
1900
+ $ui_diff tag add sel 0.0 end
1901
+ tk_textCopy $ui_diff
1902
+ $ui_diff tag remove sel 0.0 end
1903
+ "
1904
+bind $ui_diff <Any-Button-3> "tk_popup $ui_diff.ctxm %X %Y"
1905
+
1906
# -- Status Bar
1907
set ui_status_value {Initializing...}
1908
label .status -textvariable ui_status_value \