mc.tcl 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383
  1. # Midnight Commander Tk code.
  2. # Copyright (C) 1995, 1996, 1997 Miguel de Icaza
  3. #
  4. #
  5. # Todo:
  6. # Fix the internal viewer
  7. # Missing commands: mc_file_info, mc_open_with
  8. # The default buttons have a problem with the new frame around them:
  9. # they don't display the focus.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version.
  15. #
  16. # This program is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. # GNU General Public License for more details.
  20. #
  21. # You should have received a copy of the GNU General Public License
  22. # along with this program; if not, write to the Free Software
  23. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
  24. wm iconname . tkmc
  25. wm title . "Midnight Commander (TK edition)"
  26. #
  27. # Menu routines
  28. #
  29. proc create_top_menu {} {
  30. global top_menus
  31. global setup
  32. set top_menus ""
  33. frame .mbar -relief raised -bd 2
  34. pack .mbar -side top -fill x
  35. }
  36. #
  37. # Widget: WMenu
  38. #
  39. proc create_menu {str topmenu} {
  40. global top_menus
  41. global setup
  42. menubutton .mbar.$topmenu -text $str -underline 0 -menu .mbar.$topmenu.menu
  43. pack .mbar.$topmenu -side left
  44. menu .mbar.$topmenu.menu -tearoff $setup(tearoff)
  45. set top_menus "$top_menus $topmenu"
  46. }
  47. proc create_mentry {topmenu entry cmd idx} {
  48. .mbar.$topmenu.menu add command -label "$entry" -command "$cmd $idx"
  49. }
  50. proc add_separator {topmenu} {
  51. .mbar.$topmenu.menu add separator
  52. }
  53. #
  54. # Widget: WButton
  55. #
  56. proc newbutton {name cmd text isdef} {
  57. if $isdef {
  58. frame $name -relief sunken -bd 1
  59. set name "$name.button"
  60. }
  61. button $name -text "$text" -command $cmd -justify left
  62. if $isdef {
  63. pack $name -padx 1m -pady 1m
  64. }
  65. }
  66. #
  67. # Widget: WGauge
  68. #
  69. proc newgauge {win} {
  70. global setup
  71. canvas $win -height $setup(heightc) -width 250 -relief sunken -border 2
  72. $win create rectangle 0 0 0 0 -tags gauge -fill black -stipple gray50
  73. # So that we can tell the C code, which is the gauge size currently
  74. bind $win <Configure> "x$win %w"
  75. }
  76. # Used to show the gauge information
  77. proc gauge_shown {win} {
  78. # $win configure -relief sunken -border 2
  79. }
  80. # Used to hide the gauge information.
  81. proc gauge_hidden {win} {
  82. # $win configure -relief flat -border 0
  83. $win coords gauge 0 0 0 0
  84. }
  85. #
  86. # Widget: WView
  87. #
  88. proc view_size {cmd w h} {
  89. global setup
  90. $cmd dim [expr $w/$setup(widthc)] [expr $h/$setup(heightc)]
  91. }
  92. proc newview {is_panel container winname cmd} {
  93. global setup
  94. # FIXME: The trick to get the window without too much
  95. # movement/flicker is to use an extra frame, and use the placer
  96. # like it was done in WInfo.
  97. if $is_panel {
  98. set width [expr [winfo width $container]/$setup(widthc)]
  99. set height [expr [winfo height $container]/$setup(heightc)]
  100. }
  101. frame $winname
  102. frame $winname.v
  103. frame $winname.v.status
  104. eval text $winname.v.view $setup(view_normal) -font $setup(panelfont)
  105. # Create the tag names for the viewer attributes
  106. eval $winname.v.view tag configure bold $setup(view_bold)
  107. eval $winname.v.view tag configure underline $setup(view_underline)
  108. eval $winname.v.view tag configure mark $setup(view_mark)
  109. eval $winname.v.view tag configure normal $setup(view_normal)
  110. # Make the status fields
  111. label $winname.v.status.filename
  112. label $winname.v.status.column
  113. label $winname.v.status.size
  114. label $winname.v.status.flags
  115. pack $winname.v.status.filename -side left
  116. pack $winname.v.status.column -anchor w -side left -fill x -expand 1
  117. pack $winname.v.status.size -anchor w -side left -fill x -expand 1
  118. pack $winname.v.status.flags -anchor w -side left -fill x -expand 1
  119. # Pack the main components
  120. pack $winname.v.status -side top -fill x
  121. pack $winname.v.view -side bottom -expand 1 -fill both
  122. pack $winname.v -expand 1 -fill both
  123. bindtags $winname.v.view "all . $winname.v.view"
  124. bind $winname.v.view <Configure> "view_size $cmd %w %h"
  125. if $is_panel {
  126. $winname.v.view configure -width $width -height $height
  127. pack $winname
  128. }
  129. }
  130. proc view_update_info {win fname col size flags} {
  131. $win.v.status.filename configure -text "File: $fname"
  132. $win.v.status.column configure -text "Column: $col"
  133. $win.v.status.size configure -text "$size bytes"
  134. $win.v.status.flags configure -text "$flags"
  135. }
  136. #
  137. # Hack: remove all the text on the window and then insert
  138. # new lines. Maybe the newlines
  139. proc cleanview {win} {
  140. $win delete 1.0 end
  141. $win insert 1.0 "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
  142. }
  143. #
  144. # Widget: WRadio
  145. #
  146. proc newradio {name} {
  147. frame $name
  148. global last_radio
  149. set last_radio $name
  150. }
  151. proc radio_item {idx text cmd act} {
  152. global last_radio
  153. radiobutton $last_radio.$idx -text "$text" -variable v$last_radio -value $idx -command "$cmd select $idx"
  154. if $act {
  155. $last_radio.$idx select
  156. }
  157. pack $last_radio.$idx -side top -anchor w
  158. }
  159. #
  160. # Widget: Input
  161. #
  162. #
  163. proc entry_save_sel {win} {
  164. global sel
  165. if [$win selection present] {
  166. set sel(pres) 1
  167. set sel(first) [$win index sel.first]
  168. set sel(last) [$win index sel.last]
  169. } else {
  170. set sel(pres) 0
  171. }
  172. }
  173. proc entry_restore_sel {win} {
  174. global sel
  175. if $sel(pres) {
  176. $win selection from $sel(first)
  177. $win selection to $sel(last)
  178. }
  179. }
  180. proc entry_click {win x} {
  181. global sel
  182. set p [$win index @$x]
  183. x$win mouse $p
  184. x$win setmark
  185. set sel(from) $p
  186. }
  187. proc entry_move {win x} {
  188. global sel
  189. set p [$win index @$x]
  190. $win selection from $sel(from)
  191. $win selection to $p
  192. x$win mouse $p
  193. }
  194. proc bind_entry {win} {
  195. bind $win <1> "entry_click $win %x"
  196. bind $win <B1-Motion> "entry_move $win %x"
  197. }
  198. proc newinput {name text} {
  199. entry $name -relief sunken -background white -foreground black
  200. $name insert 0 "$text"
  201. bindtags $name "all . $name "
  202. bind_entry $name
  203. }
  204. #
  205. # Widget: WCheck
  206. #
  207. proc newcheck {name cmd text act} {
  208. checkbutton $name -text "$text" -command "$cmd"
  209. if $act { $name select }
  210. }
  211. #
  212. # Widget: WInfo
  213. #
  214. # window is the container name and widget name: .left.o2
  215. # container is the container name: .left
  216. #
  217. proc info_entry {win name text} {
  218. frame $win.b.finfo.$name
  219. label $win.b.finfo.$name.label -text "$text"
  220. label $win.b.finfo.$name.info
  221. grid $win.b.finfo.$name.label -row 0 -column 0 -sticky we
  222. grid $win.b.finfo.$name.info -row 0 -column 1 -sticky w
  223. grid columnconfigure $win.b.finfo.$name 0 -minsize 100
  224. }
  225. proc newinfo {container window version} {
  226. global setup
  227. set width [winfo width $container]
  228. set height [winfo height $container]
  229. frame $window -width $width -height $height \
  230. -borderwidth [expr $setup(widthc)/2]
  231. frame $window.b
  232. frame $window.b.v
  233. frame $window.b.finfo -relief groove -borderwidth 2
  234. frame $window.b.fs -relief groove -borderwidth 2
  235. label $window.b.v.version -text " The Midnight Commander $version " \
  236. -relief groove
  237. pack $window.b.v.version -fill x
  238. info_entry $window fname "File:"
  239. info_entry $window location "Location:"
  240. info_entry $window mode "Mode:"
  241. info_entry $window links "Links:"
  242. info_entry $window owner "Owner:"
  243. info_entry $window size "Size:"
  244. info_entry $window created "Created:"
  245. info_entry $window modified "Modified:"
  246. info_entry $window access "Access:"
  247. pack $window.b.finfo.fname \
  248. $window.b.finfo.location $window.b.finfo.mode $window.b.finfo.links \
  249. $window.b.finfo.owner $window.b.finfo.size $window.b.finfo.created \
  250. $window.b.finfo.modified $window.b.finfo.access \
  251. -side top -anchor w
  252. label $window.b.fs.fsys
  253. label $window.b.fs.dev
  254. label $window.b.fs.type
  255. frame $window.b.fs.free
  256. label $window.b.fs.free.label
  257. newcanvas $window.b.fs.free.canvas
  258. pack $window.b.fs.free.label -side left
  259. pack $window.b.fs.free.canvas -side left
  260. frame $window.b.fs.freeino
  261. label $window.b.fs.freeino.label
  262. newcanvas $window.b.fs.freeino.canvas
  263. pack $window.b.fs.freeino.label -side left
  264. pack $window.b.fs.freeino.canvas -side left
  265. pack $window.b.fs.fsys \
  266. $window.b.fs.dev $window.b.fs.type \
  267. $window.b.fs.free \
  268. $window.b.fs.freeino -side top -anchor w -padx $setup(widthc)
  269. pack $window.b.v -side top -anchor w -fill x -expand 1
  270. pack $window.b.fs -side bottom -anchor w -fill x -expand 1
  271. pack $window.b.finfo -side top -anchor w \
  272. -fill x -expand 1
  273. pack $window.b
  274. pack $window -fill both -expand 1
  275. # pack $window.b
  276. place $window.b -in $window -relx 0 -rely 0 -relheight 1 -relwidth 1
  277. }
  278. proc info_bar {win percent} {
  279. global setup
  280. set w [winfo width $win]
  281. set s [expr (100-$percent)*$w/100]
  282. $win coords bar 0 0 $s 50
  283. # puts stderr "Width: $w $s\n\r"
  284. }
  285. proc info_none {win} {
  286. $win coords bar 0 0 0 0
  287. }
  288. proc newcanvas {win} {
  289. global setup
  290. canvas $win -height $setup(heightc) -relief sunken -border 2
  291. $win create rectangle 0 0 0 0 -tags bar -fill black -stipple gray50
  292. }
  293. proc infotext {win text} {
  294. $win configure -text $text
  295. }
  296. proc xinfotext {win text} {
  297. $win.info configure -text $text
  298. }
  299. # w containes the window name *and* the .b frame (like: .left.o2.b)
  300. # FIXME: We should also display the rdev information
  301. proc info_update {w
  302. fname dev ino
  303. mode mode_oct
  304. links owner group
  305. have_blocks blocks
  306. size
  307. have_rdev rdev rdev2
  308. create modify access
  309. fsys dev type
  310. have_space avail percent total
  311. have_ino nfree inoperc inotot} {
  312. #
  313. # Set all the text information
  314. #
  315. xinfotext $w.finfo.fname "$fname"
  316. xinfotext $w.finfo.location "${dev}h:${ino}h"
  317. xinfotext $w.finfo.mode "$mode ($mode_oct)"
  318. xinfotext $w.finfo.links "$links"
  319. xinfotext $w.finfo.owner "$owner/$group"
  320. if $have_blocks {
  321. xinfotext $w.finfo.size "$size ($blocks blocks)"
  322. } else {
  323. xinfotext $w.finfo.size "$size"
  324. }
  325. xinfotext $w.finfo.created "$create"
  326. xinfotext $w.finfo.modified "$modify"
  327. xinfotext $w.finfo.access "$access"
  328. infotext $w.fs.fsys "Filesystem:\t$fsys"
  329. infotext $w.fs.dev "Device:\t\t$dev"
  330. infotext $w.fs.type "Type:\t\t$type"
  331. if $have_space {
  332. infotext $w.fs.free.label \
  333. "Free Space $avail ($percent%) of $total"
  334. info_bar $w.fs.free.canvas $percent
  335. } else {
  336. infotext $w.fs.free.label "No space information"
  337. info_none $w.fs.free.canvas
  338. }
  339. if $have_ino {
  340. infotext $w.fs.freeino.label \
  341. "Free inodes $nfree ($inoperc%) of $inotot"
  342. info_bar $w.fs.freeino.canvas $inoperc
  343. } else {
  344. infotext $w.fs.freeino.label "No inode information"
  345. info_none $w.fs.freeino.canvas
  346. }
  347. }
  348. #
  349. # Widget: listbox
  350. #
  351. proc listbox_sel {win item} {
  352. $win selection clear 0 end
  353. $win selection set $item
  354. $win see $item
  355. }
  356. #
  357. # Widget: WPanel
  358. #
  359. proc panel_select {w pos cback} {
  360. $w.m.p.panel tag add selected $pos.0 "$pos.0 lineend"
  361. $w.m.p.panel see $pos.0
  362. $cback top [$w.m.p.panel index @0,0]
  363. }
  364. proc panel_scroll {win cback args} {
  365. eval "$win yview $args"
  366. $cback top [$win index @0,0]
  367. }
  368. proc cmd_sort_add {name menu cmd} {
  369. $menu add command -label $name -command "$cmd sort $name"
  370. }
  371. proc panel_setup {which cmd} {
  372. global setup
  373. frame $which
  374. set m $which.cwd.menu
  375. menubutton $which.cwd -text "loading..." -bd 1 -relief raised \
  376. -menu $m -indicatoron 0
  377. menu $m -tearoff 0
  378. menu [set mm $m.sort] -tearoff 0
  379. $m add command -label "Reverse sort order" -command "$cmd reverse"
  380. $m add cascade -label "Sort" -menu $mm
  381. cmd_sort_add "Name" $mm $cmd
  382. cmd_sort_add "Extension" $mm $cmd
  383. cmd_sort_add "Size" $mm $cmd
  384. cmd_sort_add "Modify Time" $mm $cmd
  385. cmd_sort_add "Access Time" $mm $cmd
  386. cmd_sort_add "Change Time" $mm $cmd
  387. cmd_sort_add "Inode" $mm $cmd
  388. cmd_sort_add "Type" $mm $cmd
  389. cmd_sort_add "Links" $mm $cmd
  390. cmd_sort_add "NGID" $mm $cmd
  391. cmd_sort_add "NUID" $mm $cmd
  392. cmd_sort_add "Owner" $mm $cmd
  393. cmd_sort_add "Group" $mm $cmd
  394. cmd_sort_add "Unsorted" $mm $cmd
  395. $m add command -label "Refresh" -command "$cmd refresh"
  396. $m add separator
  397. $m add command -label "Set mask" -command "$cmd setmask"
  398. $m add command -label "No mask" -command "$cmd nomask"
  399. frame $which.m
  400. label $which.mini
  401. scrollbar $which.m.scroll -width 3m
  402. frame $which.m.p -relief sunken -borderwidth 2
  403. # The sort bar
  404. if $setup(with_sortbar) {
  405. canvas $which.m.p.types \
  406. -borderwidth 0\
  407. -back $setup(def_back) \
  408. -highlightthickness 0 -height 0
  409. pack $which.m.p.types -side top -fill x
  410. }
  411. scrollbar $which.m.p.scroll -width 3m -orient horizontal
  412. # The file listing panel
  413. text $which.m.p.panel -width $setup(cols) -yscroll "$which.m.scroll set" \
  414. -fore $setup(def_fore) -back $setup(def_back) \
  415. -wrap none -height $setup(lines) -font $setup(panelfont) \
  416. -relief flat -borderwidth 0 -highlightthickness 0 \
  417. -xscroll "$which.m.p.scroll set"
  418. bindtags $which.m.p.panel "all . $which.m.p.panel"
  419. proc x$which.m.p.panel {x} "$cmd \$x"
  420. pack $which.m.p.panel -side top -fill both -expand 1
  421. pack $which.m.p.scroll -side top -fill x
  422. pack $which.m.p -side left -fill both -expand 1
  423. pack $which.m.scroll -side right -fill y
  424. pack $which.cwd -side top -anchor w
  425. pack $which.m -side top -fill both -expand 1
  426. pack $which.mini -side top -fill x
  427. pack $which -fill both -expand 1
  428. config_colors $which.m.p.panel
  429. }
  430. #
  431. # Draging the panels:
  432. # mc_x and mc_y contains the last positions where the mouse was
  433. # mc_repeat contains the id of the after command.
  434. #
  435. proc panel_cancel_repeat {} {
  436. global mc_repeat
  437. after cancel $mc_repeat
  438. set mc_repeat {}
  439. }
  440. proc panel_drag {w cmd n} {
  441. global mc_y
  442. global mc_x
  443. global mc_repeat
  444. if {$mc_y >= [winfo height $w]} {
  445. $w yview scroll 1 units
  446. } elseif {$mc_y < 0} {
  447. $w yview scroll -1 units
  448. } else {
  449. return
  450. }
  451. $cmd top [$w index @0,0]
  452. $cmd motion $n [$w index @$mc_x,$mc_y]
  453. set mc_repeat [after 50 panel_drag $w $cmd $n]
  454. }
  455. #
  456. # This routine passes the size of the text widget back to the C code
  457. #
  458. proc panel_size {cmd panel w h} {
  459. global setup
  460. set setup(real_height) $h
  461. set setup(real_width) $w
  462. if $setup(with_icons) {
  463. set setup(height) [expr $h-setup(iconheight)]
  464. set setup(width) [expr $w-$setup(iconwidth)]
  465. set setup(lines) [expr $setup(height)/$setup(heightc)]
  466. set setup(cols) [expr $setup(width)/$setup(widthc)]
  467. } else {
  468. set setup(height) $h
  469. set setup(width) $w
  470. set setup(lines) [expr $h/$setup(heightc)]
  471. set setup(cols) [expr $w/$setup(widthc)]
  472. }
  473. $cmd resize $panel
  474. }
  475. #
  476. # Called on the first idle loop to configure the sizes of the thing
  477. #
  478. proc panel_conf {panel cmd} {
  479. global setup
  480. set font [lindex [$panel configure -font] 4]
  481. set fontinfo [$cmd fontdim $font $panel]
  482. set setup(heightc) [lindex $fontinfo 0]
  483. set setup(widthc) [lindex $fontinfo 1]
  484. bind $panel <Configure> "panel_size $cmd $panel %w %h"
  485. }
  486. #
  487. # Manage the bar that keeps the sort orders
  488. #
  489. proc panel_reset_sort_labels {win} {
  490. # $win.m.p.types delete all
  491. }
  492. proc panel_sort_label_start {win} {
  493. # $win.m.p.types delete all
  494. }
  495. #
  496. # This right now uses a canvas, creates labels and places them
  497. # on the canvas. The button emulation is done with a manual
  498. # bind.
  499. #
  500. proc panel_add_sort {win text_len text pos end_pos tag} {
  501. global setup
  502. if {$setup(with_sortbar) == 0} return
  503. catch { destroy $win.m.p.types.$pos }
  504. label $win.m.p.types.$pos -text $text -borderwidth 2 \
  505. -font $setup(panelfont) -relief raised
  506. $win.m.p.types create window $pos 0 -window $win.m.p.types.$pos -anchor nw
  507. $win.m.p.types configure -height [expr $setup(heightc)+8]
  508. $win.m.p.types create line $end_pos 1 $end_pos [expr $setup(heightc)-1] -fill gray
  509. # Simulate the button.
  510. bind $win.m.p.types.$pos <Button-1> "
  511. $win.m.p.types.$pos configure -relief sunken
  512. x$win sort $tag
  513. after 100 { $win.m.p.types.$pos configure -relief raised }
  514. "
  515. }
  516. #
  517. # Called back from the action menu
  518. #
  519. proc popup_add_action {filename cmd idx} {
  520. global setup
  521. menu [set m .m.action] -tearoff 0
  522. .m add cascade -foreground $setup(action_foreground) -label "$filename" -menu $m
  523. $m add command -label "Info" -command "mc_file_info \"$filename\""
  524. $m add command -label "Open with..." -command "mc_open_with \"$filename\""
  525. $m add separator
  526. $m add command -label "Copy..." -command "$cmd invoke %d Copy"
  527. $m add command -label "Rename, move..." -command "$cmd invoke %d Move"
  528. $m add command -label "Delete..." -command "$cmd invoke %d Delete"
  529. $m add separator
  530. $m add command -label "Open" -command "$cmd invoke %d Open"
  531. $m add command -label "View" -command "$cmd invoke %d View"
  532. }
  533. proc start_drag {mode panel_cmd W x y X Y} {
  534. global drag_mode
  535. global drag_text
  536. set drag_mode $mode
  537. set drag_text [$panel_cmd dragtext [$W index @$x,$y]]
  538. set drag_text "$mode $drag_text"
  539. catch {destroy .drag}
  540. toplevel .drag
  541. wm overrideredirect .drag 1
  542. wm withdraw .drag
  543. label .drag.text -text "$drag_text"
  544. pack .drag.text
  545. wm deiconify .drag
  546. wm geometry .drag +$X+$Y
  547. }
  548. proc drag_test {token} {
  549. if {[winfo children $token] == ""} {
  550. label $token.value -text "Zonzo"
  551. pack $token.value
  552. }
  553. $token.value configure -text Hla
  554. return "caca";
  555. }
  556. proc mc_drag_target {} {
  557. global DragDrop
  558. set data $DragDrop(text)
  559. }
  560. proc mc_drag_send {} {
  561. # puts "drag send"
  562. }
  563. #
  564. # Mouse bindings for the panels
  565. #
  566. proc panel_bind {the_panel panel_cmd} {
  567. global setup
  568. set pn "$the_panel.m.p.panel"
  569. bind $pn <Button-1> "
  570. $panel_cmd mdown 2 \[%W index @%x,%y]
  571. "
  572. bind $pn <ButtonRelease-1> "
  573. panel_cancel_repeat
  574. $panel_cmd mup 2 \[%W index @%x,%y]"
  575. bind $pn <Double-1> "
  576. panel_cancel_repeat
  577. $panel_cmd double 2 \[%W index @%x,%y]"
  578. bind $pn <B1-Motion> "
  579. set mc_x %x
  580. set mc_y %y
  581. $panel_cmd motion 2 \[%W index @%x,%y]
  582. "
  583. bind $pn <B1-Leave> "
  584. set mc_x %x
  585. set mc_y %y
  586. panel_drag %W $panel_cmd 2
  587. "
  588. bind $pn <B1-Enter> panel_cancel_repeat
  589. if $setup(b2_marks) {
  590. bind $pn <Button-2> "
  591. $panel_cmd mdown 1 \[%W index @%x,%y]"
  592. bind $pn <ButtonRelease-2> "
  593. $panel_cmd mup 1 \[%W index @%x,%y]
  594. panel_cancel_repeat
  595. "
  596. bind $pn <B2-Motion> "
  597. set mc_x %x
  598. set mc_y %y
  599. $panel_cmd motion 1 \[%W index @%x,%y]
  600. "
  601. bind $pn <B2-Leave> "
  602. set mc_x %x
  603. set mc_y %y
  604. panel_drag %W $panel_cmd 1
  605. "
  606. } else {
  607. # We have blt
  608. # blt_drag&drop source $pn config -button 2 -packagecmd drag_test \
  609. # -selftarget 1
  610. # blt_drag&drop source $pn handler text dd_send_file
  611. }
  612. # Menu popup.
  613. bind $pn <Button-3> "
  614. $panel_cmd mdown 2 \[%W index @%x,%y]
  615. catch {destroy .m}
  616. menu .m -tearoff 0
  617. $panel_cmd load \[%W index @%x,%y] %X %Y
  618. #Buggy Tk8.0
  619. catch {tk_popup .m %X %Y}
  620. "
  621. bind $pn <B2-Enter> panel_cancel_repeat
  622. $the_panel.m.scroll configure \
  623. -command "panel_scroll $pn $panel_cmd"
  624. $the_panel.m.p.scroll configure \
  625. -command "$pn xview"
  626. panel_conf $pn $panel_cmd
  627. }
  628. proc panel_info {item} {
  629. global setup
  630. return $setup($item)
  631. }
  632. proc panel_mark {tag panel n} {
  633. config_colors $panel
  634. $panel tag add $tag "${n}.0" "${n}.0 lineend"
  635. }
  636. # op is add or remove
  637. proc panel_mark_entry {win op line} {
  638. $win.m.p.panel tag $op marked $line.0 "$line.0 lineend"
  639. }
  640. proc panel_unmark_entry {win line} {
  641. $win.m.p.panel tag remove selected $line.0 "$line.0 lineend"
  642. }
  643. #
  644. # Misc routines
  645. #
  646. # Configure the panel tags
  647. proc config_colors {which} {
  648. global setup
  649. # se -- selected file
  650. $which tag configure selected -back $setup(panelcolor,selected_back)
  651. foreach v {marked directory executable regular selected} {
  652. $which tag configure $v -fore $setup(panelcolor,$v)
  653. }
  654. $which tag configure directory -font $setup(paneldir)
  655. $which tag raise marked
  656. }
  657. proc tclerror {msg} {
  658. puts stderr "TkError: [$msg]\n\r"
  659. }
  660. #
  661. # FIXME: This is not finished, have to deal with activefore, activeback
  662. # highlight{fore,back}
  663. #
  664. proc error_colors {wins} {
  665. global setup
  666. foreach widget $wins {
  667. catch "$widget configure -foreground $setup(errorfore)"
  668. catch "$widget configure -background $setup(errorback)"
  669. }
  670. }
  671. #
  672. #
  673. # Layout routines
  674. #
  675. #
  676. proc layout_midnight {} {
  677. global one_window
  678. global wlist
  679. #puts $wlist
  680. #
  681. # we want to make the prompt and the input line sunken
  682. # so we sunk the frame, and set a borderwidth for it
  683. # while removing the sunken attribute set by the newinput
  684. .p.i0 configure -relief flat
  685. .p configure -relief sunken -borderwidth 2
  686. pack .p.l5 -side left
  687. pack .p.i0 -side left -expand 1 -fill x -anchor e
  688. pack .n4 -side bottom -fill x
  689. pack .p -side bottom -fill x
  690. if $one_window {
  691. pack .left -side top -side left -fill both -expand 1
  692. pack .right -side top -side right -fill both -expand 1
  693. }
  694. }
  695. proc layout_query {} {
  696. global wlist
  697. # puts "$wlist"
  698. set t [llength $wlist]
  699. if {$t == 2} {
  700. pack .query.l1 -side top -pady 2m -padx 2m
  701. pack .query.b0 -side right -ipadx 2m -padx 4m -pady 2m -expand 1
  702. } else {
  703. pack .query.l1 -side top -pady 2m -padx 2m
  704. for {set b 2} {$b != 1} {incr b} {
  705. if {$b == $t} {
  706. set b 0
  707. }
  708. pack .query.b$b -side right -ipadx 2m -padx 4m -pady 2m -expand 1
  709. }
  710. }
  711. }
  712. proc layout_listbox {} {
  713. scrollbar .listbox.s -width 3m -command {.listbox.x0 yview}
  714. .listbox.x0 configure -yscroll {.listbox.s set}
  715. pack .listbox.s -fill y -side right
  716. pack .listbox.x0 -expand 1 -fill both -padx 4m -pady 4m -side left
  717. }
  718. proc layout_quick_confirm {} {
  719. pack .quick_confirm.c.c1 .quick_confirm.c.c2 .quick_confirm.c.c3 \
  720. -side top -anchor w
  721. pack .quick_confirm.b.b0 .quick_confirm.b.b4 -side left -padx 4m -expand 1
  722. pack .quick_confirm.c -side top -pady 4m
  723. pack .quick_confirm.b -side top -pady 2m
  724. }
  725. proc layout_quick_file_mask {} {
  726. global wlist
  727. # puts stderr "$wlist"
  728. # We add some space
  729. .quick_file_mask configure -borderwidth 5m
  730. pack .quick_file_mask.b.b1 .quick_file_mask.b.b2 \
  731. -side left -expand 1 -padx 4m
  732. pack .quick_file_mask.l3 -side top -anchor w -expand 1
  733. pack .quick_file_mask.s.i5 -fill x -expand 1 -anchor w
  734. pack .quick_file_mask.s.c6 -anchor e -padx 4m -pady 1m
  735. pack .quick_file_mask.s -expand 1 -fill x -side top
  736. pack .quick_file_mask.d.l7 -pady 4m
  737. pack .quick_file_mask.d -side top -anchor w
  738. pack .quick_file_mask.i4 -expand 1 -fill x -side top
  739. pack .quick_file_mask.t.c8 .quick_file_mask.t.c0 -side top -anchor e
  740. catch {pack .quick_file_mask.t.c9 -side top -anchor e}
  741. pack .quick_file_mask.t -side top -anchor e
  742. frame .quick_file_mask.space -height 4m
  743. pack .quick_file_mask.space -side top
  744. pack .quick_file_mask.b -fill x -expand 1 -side top
  745. }
  746. proc layout_quick_vfs {} {
  747. global wlist
  748. # puts stderr "$wlist"
  749. pack .quick_vfs.t.l1 -side left
  750. pack .quick_vfs.t.i2 -side left -expand 1 -fill x -padx 2m
  751. pack .quick_vfs.t.l3 -side left
  752. pack .quick_vfs.l.l4 -side top -anchor w
  753. pack .quick_vfs.l.r5 -side left -anchor w
  754. pack .quick_vfs.l.i6 -side right -anchor se
  755. pack .quick_vfs.b.b7 .quick_vfs.b.b0 -padx 4m -side left -expand 1
  756. pack .quick_vfs.t -side top -expand 1 -fill x -pady 4m -padx 4m
  757. pack .quick_vfs.l -side top -expand 1 -fill x -padx 4m
  758. pack .quick_vfs.b -side top -expand 1 -fill x -padx 4m -pady 4m
  759. }
  760. proc layout_dbits {} {
  761. pack .dbits.r1 -anchor w -padx 4m -pady 4m -side top
  762. pack .dbits.b0 -side top
  763. }
  764. proc layout_chown {} {
  765. global setup
  766. pack .chown.b.b8 .chown.b.b0 -side left -padx 4m -expand 1
  767. # May be invoked with different number of buttons
  768. # There is already a problem: the cancel button is
  769. # not close to the ok button, I will have to look into this.
  770. catch {
  771. pack .chown.b.b9 .chown.b.b10 .chown.b.b11 \
  772. -side left -padx 4m -expand 1
  773. }
  774. label .chown.l.fname -text {File name}
  775. label .chown.l.owner -text {Owner name}
  776. label .chown.l.group -text {Group name}
  777. label .chown.l.size -text {Size}
  778. label .chown.l.perm -text {Permission}
  779. pack \
  780. .chown.l.fname .chown.l.l7 \
  781. .chown.l.owner .chown.l.l6 \
  782. .chown.l.group .chown.l.l5 \
  783. .chown.l.size .chown.l.l4 \
  784. .chown.l.perm .chown.l.l3 -side top -anchor w -padx 2m
  785. foreach i {l3 l4 l5 l6 l7} {
  786. .chown.l.$i configure -fore $setup(high)
  787. }
  788. pack .chown.l.l3 .chown.l.l4 .chown.l.l5 .chown.l.l6 .chown.l.l7 \
  789. -side top -pady 1m -padx 4m -anchor w
  790. # Configure the listboxes
  791. scrollbar .chown.f.s -width 3m -command {.chown.f.x2 yview}
  792. .chown.f.x2 configure -yscroll {.chown.f.s set}
  793. label .chown.f.l -text {Group name}
  794. pack .chown.f.l -side top -anchor w
  795. pack .chown.f.x2 -side left -fill y -expand 1
  796. pack .chown.f.s -side right -fill y -expand 1
  797. scrollbar .chown.g.s -width 3m -command {.chown.g.x1 yview}
  798. .chown.g.x1 configure -yscroll {.chown.g.s set}
  799. label .chown.g.l -text {User name}
  800. pack .chown.g.l -side top -anchor w
  801. pack .chown.g.x1 -side left -fill y -expand 1
  802. pack .chown.g.s -side right -fill y -expand 1
  803. .chown.b configure -relief sunken
  804. pack .chown.b -side bottom -pady 4m -fill x
  805. pack .chown.g .chown.f -side left -padx 4m -pady 4m -expand 1 -fill y
  806. pack .chown.l -side right -padx 4m
  807. }
  808. proc layout_chmod {} {
  809. global wlist
  810. # puts stderr "$wlist \n\r"
  811. pack .chmod.c.c5 .chmod.c.c6 .chmod.c.c7 .chmod.c.c8 .chmod.c.c9 \
  812. .chmod.c.c10 \
  813. .chmod.c.c11 .chmod.c.c12 .chmod.c.c13 .chmod.c.c14 .chmod.c.c15 \
  814. .chmod.c.c16 -side top -anchor w
  815. pack .chmod.b.b17 .chmod.b.b0 -side left -padx 4m -pady 4m -side left
  816. catch {
  817. pack .chmod.b.b18 .chmod.b.b19 .chmod.b.b19 .chmod.b.b20 \
  818. .chmod.b.b21 -side left -padx 4m -pady 4m -side left
  819. }
  820. label .chmod.l.msg -text {Use "t" or Insert to\nmark attributes}
  821. label .chmod.l.fname -text {Name}
  822. label .chmod.l.perm -text {Permission (octal)}
  823. label .chmod.l.owner -text {Owner name}
  824. label .chmod.l.group -text {Group name}
  825. pack \
  826. .chmod.l.fname .chmod.l.l4 \
  827. .chmod.l.perm .chmod.l.l1 \
  828. .chmod.l.owner .chmod.l.l3 \
  829. .chmod.l.group .chmod.l.l2 .chmod.l.msg -side top -anchor w -padx 2m
  830. pack .chmod.b -side bottom
  831. pack .chmod.l -side right -padx 4m -anchor n -pady 4m
  832. pack .chmod.c -side left -padx 4m -pady 4m
  833. }
  834. proc layout_view {} {
  835. global wlist
  836. pack [lindex $wlist 0] -side bottom -fill x
  837. pack [lindex $wlist 1] -side top -expand 1 -fill both
  838. }
  839. proc layout_replace {} {
  840. global wlist
  841. error_colors "$wlist .replace"
  842. set alist {}
  843. set plist {}
  844. set ilist {}
  845. foreach a $wlist {
  846. if [regexp ^.replace.p.l $a] {
  847. set plabel $a
  848. } elseif [regexp ^.replace.p $a] {
  849. set plist "$plist $a"
  850. } elseif [regexp ^.replace.a.l $a] {
  851. set alabel $a
  852. } elseif [regexp ^.replace.a $a] {
  853. set alist "$alist $a"
  854. } elseif [regexp ^.replace.i $a] {
  855. set ilist "$ilist $a"
  856. } elseif [regexp ^.replace.b $a] {
  857. set abortbutton $a
  858. } else {
  859. set fname $a
  860. }
  861. }
  862. # puts stderr "$wlist\n\r"
  863. # puts stderr "alist: $alist\n\rplist: $plist\n\rilist: $ilist\n\r"
  864. # puts stderr "plabel: $plabel\n\rfname: $fname"
  865. pack $fname -side top -fill x -anchor w -pady 6m -padx 12m
  866. pack $abortbutton -side bottom -anchor e -padx 8m -pady 4m
  867. eval pack $ilist -side top -anchor w
  868. pack .replace.i -padx 10m -pady 2m -anchor w
  869. pack $plabel -side left -anchor w -padx 10m
  870. eval pack $plist -side left -anchor e -fill x
  871. pack .replace.p -side top -fill x -padx 10m
  872. pack $alabel -side left -anchor w -padx 10m
  873. eval pack $alist -side left -anchor e -fill x
  874. pack .replace.a -side top -fill x -padx 10m
  875. }
  876. proc layout_complete {} {
  877. global wlist
  878. eval pack $wlist -side top
  879. }
  880. proc layout_opwin {} {
  881. global wlist
  882. global setup
  883. pack .opwin.b.b0 .opwin.b.b14 -side left -expand 1
  884. pack .opwin.f0.l1 .opwin.f0.l2 -side left -anchor w
  885. pack .opwin.f1.l3 .opwin.f1.l4 -side left -anchor w
  886. foreach a {.opwin.2.l11 .opwin.1.l8 .opwin.0.l5} {
  887. $a configure -width 8
  888. }
  889. pack .opwin.2.l11 .opwin.2.g13 -side left -fill x
  890. pack .opwin.1.l8 .opwin.1.g10 -side left -fill x
  891. pack .opwin.0.l5 .opwin.0.l6 -side left -fill x
  892. pack .opwin.b -side bottom -pady 4m -fill x
  893. pack .opwin.f0 -side top -padx 10m -anchor w
  894. pack .opwin.f1 -side top -padx 10m -pady 4m -anchor w
  895. pack .opwin.0 .opwin.1 .opwin.2 -side top -padx 4m
  896. }
  897. proc dummy_layout {name} {
  898. eval "proc layout_$name {} {
  899. global wlist
  900. # puts stderr \"\$wlist \\n\"
  901. eval pack \$wlist -side top}"
  902. }
  903. #
  904. # the achown commands will have to be rewriten
  905. # to use only widgets and no writing callbacks.
  906. #
  907. foreach i {
  908. achown tree
  909. } {
  910. dummy_layout $i
  911. }
  912. proc layout_quick_input {} {
  913. global wlist
  914. # puts stderr "$wlist \n\r"
  915. .quick_input.i1 configure -width 60
  916. label .quick_input.dummy
  917. pack .quick_input.b.b2 .quick_input.b.b3 -side left -padx 4m -expand 1
  918. pack .quick_input.b -side bottom -pady 4m
  919. pack .quick_input.dummy -side top
  920. pack .quick_input.l0 -side top -expand 1 -ipadx 2m -ipady 2m
  921. pack .quick_input.i1 -side bottom -fill x -padx 4m
  922. }
  923. proc create_drop_target {name icon} {
  924. toplevel .drop-$name
  925. button .drop-$name.b -text "Drop target"
  926. pack .drop-$name.b
  927. wm group .drop-$name .
  928. wm overrideredirect .drop-$name 1
  929. wm withdraw .drop-$name
  930. wm deiconify .drop-$name
  931. wm geometry .drop-$name +0+0
  932. # blt_drag&drop target .drop-$name.b handler file mc_drag_target
  933. # blt_drag&drop target .drop-$name.b handler text mc_drag_target
  934. }
  935. #
  936. # Creates the container
  937. #
  938. proc create_container {container} {
  939. canvas $container
  940. pack $container -fill both -expand 1
  941. }
  942. #
  943. # Removes all of the widgets in a container (.left or .right)
  944. #
  945. proc container_clean {container} {
  946. set widgets [winfo children $container]
  947. foreach widget $widgets {
  948. destroy $widget
  949. }
  950. }
  951. #
  952. # Setups the binding called after the layout procedure
  953. #
  954. proc bind_setup {win} {
  955. flush stderr
  956. bindtags $win {all $win}
  957. wm protocol $win WM_DELETE_WINDOW "tkmc e scape"
  958. bind $win <Leave>
  959. }
  960. proc keyboard_bindings {} {
  961. # Remove the Tab binding.
  962. bind all <Tab> {}
  963. bind all <KeyPress> "tkmc r %A"
  964. # Remove the Alt-key binding and put a sensible one instead
  965. bind all <Alt-KeyPress> "tkmc a %A"
  966. bind all <Control-KeyPress> "tkmc c %A"
  967. bind all <Meta-KeyPress> "tkmc a %A"
  968. foreach i {Left Right Up Down End R13 Home F27 F29 Prior \
  969. Next F35 Return KP_Enter Delete Insert BackSpace \
  970. F1 F2 F3 F4 F5 F6 F7 F8 F9 F10} {
  971. bind all <Key-$i> "tkmc k %K"
  972. }
  973. }
  974. # Centers a window based on .
  975. proc center_win {win} {
  976. global center_toplevels
  977. wm transient $win [winfo toplevel [winfo parent $win]]
  978. wm withdraw $win
  979. update idletasks
  980. if {$center_toplevels} {
  981. set ch [winfo reqheight $win]
  982. set cw [winfo reqwidth $win]
  983. set geo [split [wm geometry .] +x]
  984. set pw [lindex $geo 0]
  985. set ph [lindex $geo 1]
  986. set px [lindex $geo 2]
  987. set py [lindex $geo 3]
  988. set x [expr $px+(($pw-$cw)/2)]
  989. set y [expr $py+(($ph-$ch)/2)]
  990. wm geometry $win +$x+$y
  991. }
  992. wm deiconify $win
  993. grab $win
  994. tkwait visibility $win
  995. }
  996. #
  997. # Busy window handling
  998. #
  999. proc win_busy {w} {
  1000. $w configure -cursor watch
  1001. }
  1002. #
  1003. # Color configurations
  1004. #
  1005. proc tk_colors {} {
  1006. }
  1007. proc color_model {} {
  1008. }
  1009. # gray85 is the background for the new tk4
  1010. proc gray_colors {base} {
  1011. global setup
  1012. global have_blt
  1013. #
  1014. # set setup(def_back) [tkDarken $base 90]
  1015. # set setup(def_fore) black
  1016. # set setup(selected) [tkDarken $base 110]
  1017. # set setup(marked) SlateBlue
  1018. # set setup(high) $setup(def_back)
  1019. if {0} {
  1020. set dark_color [tkDarken $base 90]
  1021. set setup(def_back) [tkDarken $base 110]
  1022. set setup(selected) NavyBlue
  1023. set setup(selected_fg) white
  1024. } else {
  1025. set dark_color $base
  1026. set setup(def_back) #d9d9d9
  1027. set setup(selected) white
  1028. set setup(selected_fg) black
  1029. }
  1030. set setup(def_fore) black
  1031. set setup(high) yellow
  1032. #
  1033. # Panel colors:
  1034. #
  1035. # Marked files
  1036. set setup(panelcolor,marked) yellow
  1037. set setup(panelcolor,directory) blue
  1038. set setup(panelcolor,executable) red
  1039. set setup(panelcolor,regular) black
  1040. set setup(panelcolor,selected_back) white
  1041. set setup(panelcolor,selected) black
  1042. # Viewer colors
  1043. set setup(view_bold) "-fore yellow -back $dark_color"
  1044. set setup(view_underline) "-fore red -back $dark_color"
  1045. set setup(view_mark) "-fore cyan -back $dark_color"
  1046. set setup(view_normal) "-fore black -back $dark_color"
  1047. # The percentage bars on info:
  1048. set setup(percolor) "blue"
  1049. # The sort bar colors
  1050. set setup(sort_fg) $setup(def_fore)
  1051. set setup(sort_bg) $setup(def_back)
  1052. set setup(with_sortbar) 1
  1053. # We use BLT only for drag and drop, if this is not available,
  1054. # then we use the 2nd button for regular file marking.
  1055. set have_blt 0
  1056. if $have_blt {
  1057. set setup(b2_marks) 0
  1058. } else {
  1059. set setup(b2_marks) 1
  1060. }
  1061. # The errors
  1062. set setup(errorfore) white
  1063. set setup(errorback) red
  1064. }
  1065. proc bisque_colors {} {
  1066. global setup
  1067. set setup(def_back) bisque3
  1068. set setup(def_fore) black
  1069. set setup(selected) bisque2
  1070. set setup(marked) SlateBlue
  1071. set setup(high) gray
  1072. }
  1073. proc sanity_check {} {
  1074. if [catch {bindtags .}] {
  1075. puts stderr "The Midnight Commander requires Tk 4.0 beta 3 or 4\n\r"
  1076. puts stderr "You can get it from: ftp://ftp.smli.com/pub/tcl"
  1077. exit 1
  1078. }
  1079. }
  1080. #sanity_check
  1081. # Until I figure out how to remove specific bindings from a widget
  1082. # I remove all of the classes bindings.
  1083. #bind Text <Enter> {}
  1084. #bind Text <FocusIn> {}
  1085. # bind Entry <Enter> {}
  1086. # bind Entry <FocusIn> {}
  1087. keyboard_bindings
  1088. set setup(tearoff) 0
  1089. set setup(action_foreground) blue
  1090. set setup(lines) 24
  1091. set setup(cols) 40
  1092. set setup(with_icons) 0
  1093. set setup(widthc) 0
  1094. set setup(heightc) 0
  1095. set setup(real_width) 0
  1096. # Determine Tk version
  1097. set beta_4 ![catch tk_bisque]
  1098. if $beta_4 {
  1099. tk_setPalette gray85
  1100. gray_colors gray70
  1101. } else {
  1102. bisque_colors
  1103. }
  1104. ## Some globals
  1105. set mc_repeat {}
  1106. set mc_x 0
  1107. set mc_y 0
  1108. set center_toplevels 1
  1109. #set center_toplevels 0
  1110. # button .testbutton [lindex [.testbutton configure -font] 3]
  1111. #set setup(panelfont) lucidasanstypewriter-bold-14
  1112. set setup(panelfont) lucidasanstypewriter-14
  1113. set setup(paneldir) lucidasanstypewriter-bold-14
  1114. set setup(font) "-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*"
  1115. #
  1116. #
  1117. # This variable if set, will make the program load gui.*.tcl files
  1118. # instead of the gui.tcl file created during instalaltion.
  1119. set use_separate_gui_files 0
  1120. if [file exist ~/.mc/tkmc] {source ~/.mc/tkmc}
  1121. catch {
  1122. # option add *font $setup(font) userDefault
  1123. # option add *Menu*activeBackground NavyBlue
  1124. # option add *Menu*activeForeground white
  1125. # option add *Menubutton*activeBackground NavyBlue
  1126. # option add *Menubutton*activeForeground white
  1127. # option add *Button*activeBackground NavyBlue
  1128. # option add *Button*activeForeground white
  1129. ## set setup(panelfont) $setup(font)
  1130. }
  1131. proc run_gui_design {root} {
  1132. global components
  1133. create_workspace $root
  1134. gui_design $root $components
  1135. }
  1136. source $LIBDIR/gd.tcl
  1137. set tk_strictMotif 1
  1138. create_top_menu
  1139. create_drop_target Hola Zonzo