📄 create.tcl
字号:
$Editor::textMenu add separator
$Editor::textMenu add separator
$Editor::textMenu add checkbutton -label [tr "Auto Update"] \
-variable Editor::options(autoUpdate) \
-command {
set EditorData(options,autoUpdate) $Editor::options(autoUpdate)
set EditorData(options,showProc) $Editor::options(autoUpdate)
set Editor::options(showProc) $Editor::options(autoUpdate)
catch {
if {$Editor::options(autoUpdate)} {
Editor::updateObjects
}
}
}
$Editor::textMenu add checkbutton -label [tr "Show Console"] \
-variable Editor::options(showConsole) \
-command {
set EditorData(options,showConsole) $Editor::options(showConsole)
Editor::showConsole $EditorData(options,showConsole)
update idletasks
catch {$Editor::current(text) see insert}
}
$Editor::textMenu add checkbutton -label [tr "Show Code Browser"] \
-variable Editor::options(showProcs) \
-command {
set EditorData(options,showProcs) $Editor::options(showProcs)
Editor::showTreeWin $EditorData(options,showProcs)
update idletasks
catch {$Editor::current(text) see insert}
}
$Editor::textMenu add checkbutton -label [tr "Solely Console"] \
-variable Editor::options(solelyConsole) \
-command {
set EditorData(options,solelyConsole) $Editor::options(solelyConsole)
Editor::showSolelyConsole $EditorData(options,solelyConsole)
update idletasks
}
}
proc Editor::createMainToolbar {{update 0}} {
variable mainframe
variable search_combo
variable argument_combo
variable current
variable toolbarButtons
variable tb1
# toolbar 1 creation
if {$update == 0} {
set tb1 [MainFrame::addtoolbar $mainframe]
}
set bbox [ButtonBox::create $tb1.bbox1 -spacing 0 -padx 1 -pady 1]
set toolbarButtons(new) [ButtonBox::add $bbox -image [Bitmap::get new] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Create a new file"] -command Editor::newFile ]
set toolbarButtons(open) [ButtonBox::add $bbox -image [Bitmap::get open] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Open an existing file"] -command Editor::openFile ]
set toolbarButtons(save) [ButtonBox::add $bbox -image [Bitmap::get save] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Save file"] -command Editor::saveFile]
set toolbarButtons(saveAll) [ButtonBox::add $bbox -image [Bitmap::get saveAll] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Save all files"] -command Editor::saveAll]
set toolbarButtons(close) [ButtonBox::add $bbox -image [Bitmap::get delete] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Close File"] -command Editor::closeFile]
pack $bbox -side left -anchor w
set sep0 [Separator::create $tb1.sep0 -orient vertical]
pack $sep0 -side left -fill y -padx 4 -anchor w
set bbox [ButtonBox::create $tb1.bbox2 -spacing 0 -padx 1 -pady 1]
set toolbarButtons(cut) [ButtonBox::add $bbox -image [Bitmap::get cut] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Cut selection"] -command Editor::cut]
set toolbarButtons(copy) [ButtonBox::add $bbox -image [Bitmap::get copy] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Copy selection"] -command Editor::copy]
set toolbarButtons(paste) [ButtonBox::add $bbox -image [Bitmap::get paste] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Paste from Clipboard"] -command Editor::paste]
pack $bbox -side left -anchor w
set sep2 [Separator::create $tb1.sep2 -orient vertical]
pack $sep2 -side left -fill y -padx 4 -anchor w
set bbox [ButtonBox::create $tb1.bbox2b -spacing 0 -padx 1 -pady 1]
set toolbarButtons(toglcom) [ButtonBox::add $bbox -image [Bitmap::get toglcom] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Toggle Comment"] -command Editor::toggle_comment]
set toolbarButtons(comblock) [ButtonBox::add $bbox -image [Bitmap::get comblock] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Make Comment Block"] -command Editor::make_comment_block]
set toolbarButtons(unindent) [ButtonBox::add $bbox -image [Bitmap::get unindent] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Unindent Selection"] -command editorWindows::unindentSelection]
set toolbarButtons(indent) [ButtonBox::add $bbox -image [Bitmap::get indent] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Indent Selection"] -command editorWindows::indentSelection]
pack $bbox -side left -anchor w
set sep1c [Separator::create $tb1.sep1c -orient vertical]
pack $sep1c -side left -fill y -padx 4 -anchor w
set bbox [ButtonBox::create $tb1.bbox3 -spacing 0 -padx 1 -pady 1]
set toolbarButtons(undo) [ButtonBox::add $bbox -image [Bitmap::get undo] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Undo"] -command Editor::undo ]
set toolbarButtons(redo) [ButtonBox::add $bbox -image [Bitmap::get redo] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Redo"] -command Editor::redo ]
pack $bbox -side left -anchor w
set sep3 [Separator::create $tb1.sep3 -orient vertical]
pack $sep3 -side left -fill y -padx 4 -anchor w
set bbox [ButtonBox::create $tb1.bbox4 -spacing 0 -padx 1 -pady 1]
set toolbarButtons(find) [ButtonBox::add $bbox -image [Bitmap::get find] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Find Dialog"] -command Editor::search_dialog ]
set toolbarButtons(replace) [ButtonBox::add $bbox -image [Bitmap::get replace] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Replace Dialog"] -command Editor::replace_dialog ]
pack $bbox -side left -anchor w
set search_combo [ComboBox::create $tb1.combo \
-textvariable Editor::search_var\
-values {""} \
-helptext [tr "Enter Searchtext"] \
-entrybg white\
-width 15]
pack $search_combo -side left
set bbox [ButtonBox::create $tb1.bbox5 -spacing 1 -padx 1 -pady 1]
set down_arrow [ArrowButton::create $bbox.da -dir bottom \
-height 21\
-width 21\
-helptype balloon\
-helptext [tr "Search forwards"]\
-command Editor::search_forward]
set up_arrow [ArrowButton::create $bbox.ua -dir top\
-height 21\
-width 21\
-helptype balloon\
-helptext [tr "Search backwards"]\
-command Editor::search_backward]
pack $down_arrow $up_arrow -side left
pack $bbox -side left -anchor w
set sep [Separator::create $tb1.sep -orient vertical]
pack $sep -side left -fill y -padx 4 -anchor w
set bbox [ButtonBox::create $tb1.bbox1b -spacing 0 -padx 1 -pady 1]
ButtonBox::add $bbox -image [Bitmap::get stop] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Terminate Execution"] -command Editor::terminate
pack $bbox -side left -anchor w -padx 2
set bbox [ButtonBox::create $tb1.bbox1c -spacing 1 -padx 1 -pady 1]
set right_arrow [ArrowButton::create $bbox.ua -dir right\
-height 21\
-width 21\
-helptype balloon\
-helptext [tr "Test Application"]\
-command {
set code [catch Editor::execFile cmd]
if $code {
tk_messageBox -message $errorInfo -title Error -icon error
}
}]
pack $right_arrow -side left -padx 4
pack $bbox -side left -anchor w
set argument_combo [ComboBox::create $tb1.combo2 \
-textvariable Editor::argument_var\
-values {""} \
-helptext [tr "Enter optional argument"] \
-entrybg white\
-width 15]
pack $argument_combo -side left
set sep4 [Separator::create $tb1.sep4 -orient vertical]
pack $sep4 -side left -fill y -padx 4 -anchor w
set bbox [ButtonBox::create $tb1.bbox6 -spacing 1 -padx 1 -pady 1]
ButtonBox::add $bbox -image [Bitmap::get exitdoor] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Exit Ased"] -command Editor::exit_app
pack $bbox -side right -anchor w
#get Entry path out of Combo Widget
set childList [winfo children $search_combo]
foreach w $childList {if {[winfo class $w] == "Entry"} { set entry $w ; break}}
bind $entry <KeyRelease-Return> {Editor::search_forward ; break}
set childList [winfo children $argument_combo]
foreach w $childList {if {[winfo class $w] == "Entry"} { set entry2 $w ; break}}
bind $entry2 <KeyRelease-Return> {
set code [catch Editor::execFile cmd]
if $code {
tk_messageBox -message $errorInfo -title [tr "Error"] -icon error
}
break
}
}
proc Editor::createFontToolbar {{update 0}} {
variable mainframe
variable search_combo
variable argument_combo
variable current
variable toolbarButtons
variable tb2
# toolbar 2 creation
if {$update == 0} {
set tb2 [MainFrame::addtoolbar $mainframe]
}
set bbox [ButtonBox::create $tb2.bbox2 -spacing 0 -padx 1 -pady 1]
set toolbarButtons(incFont) [ButtonBox::add $bbox -image [Bitmap::get incfont] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Increase Fontsize"] -command {Editor::increaseFontSize up}]
pack $bbox -side left -anchor w
set toolbarButtons(decFont) [ButtonBox::add $bbox -image [Bitmap::get decrfont] \
-highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 -padx 1 -pady 1 \
-helptext [tr "Decrease Fontsize"] -command {Editor::increaseFontSize down}]
pack $bbox -side left -anchor w
set sep3 [Separator::create $tb2.sep3 -orient vertical]
pack $sep3 -side left -fill y -padx 4 -anchor w
set Editor::Font_var [font configure editorFont -family]
set Font_combo [ComboBox::create $tb2.combo \
-textvariable Editor::Font_var\
-values [lsort -dictionary [font families]] \
-helptext [tr "Choose Font"] \
-entrybg white\
-modifycmd {Editor::changeFont}\
]
pack $Font_combo -side left
set Editor::FontSize_var [font configure editorFont -size]
set FontSize_combo [ComboBox::create $tb2.combo2 -width 2 \
-textvariable Editor::FontSize_var\
-values {8 9 10 11 12 14 16 20 24 30} \
-helptext [tr "Choose Fontsize"] \
-entrybg white\
-modifycmd {Editor::changeFont}\
]
pack $FontSize_combo -side left
$Editor::mainframe showtoolbar 0 $Editor::toolbar1
$Editor::mainframe showtoolbar 1 $Editor::toolbar2
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -