📄 create.tcl
字号:
set pf1 [EditManager::create_treeWindow $list_notebook]
set treeWindow $pf1.sw.objTree
# Binding on tree widget
$treeWindow bindText <ButtonPress-1> Editor::tselectObject
$treeWindow bindImage <ButtonPress-1> Editor::tselectObject
bind $treeWindow.c <ButtonPress-3> {
tk_popup $Editor::treeMenu %X %Y
break
}
set f0 [EditManager::create_text $notebook [tr "Untitled"]]
set Editor::text_win($Editor::index_counter,undo_id) [new textUndoer [lindex $f0 2]]
NoteBook::compute_size $list_notebook
pack $list_notebook -side left -fill both -expand yes -padx 4 -pady 4
NoteBook::compute_size $notebook
pack $notebook -side left -fill both -expand yes -padx 4 -pady 4
pack $pw2 -fill both -expand yes
set cf0 [EditManager::create_conWindow $con_notebook]
NoteBook::compute_size $con_notebook
pack $con_notebook -side bottom -fill both -expand yes -padx 4 -pady 4
pack $pw1 -fill both -expand yes
$list_notebook raise objtree
$con_notebook raise asedCon
$notebook raise [lindex $f0 1]
pack $mainframe -fill both -expand yes
update idletasks
destroy .intro
wm protocol . WM_DELETE_WINDOW Editor::exit_app
if {!$configError} {catch Editor::restoreWindowPositions}
}
proc Editor::createMainMenu {} {
# Menu description
set Editor::mainMenu [list \
[tr File] {} {} 0 [list \
[list command [tr New] {} [tr "New File"] {} -command Editor::newFile] \
[list command [tr Open] {} [tr "Open File"] {Ctrl o} -command Editor::openFile] \
[list command [tr Save] {noFile} [tr "Save active File"] {Ctrl s} -command Editor::saveFile] \
[list command [tr "Save &as ..."] {noFile} [tr "Save active File as .."] {} -command Editor::saveFileas] \
[list command [tr "Save all"] {noFile} [tr "Save all Files"] {} -command Editor::saveAll] \
[list command [tr "Close"] {noFile} [tr "Close active File"] {} -command Editor::closeFile ] \
{separator} \
[list command [tr "E&xit"] {} [tr "Exit ASED"] {Alt x} -command Editor::exit_app] \
]\
[tr "&Edit"] {noFile} {} 0 [list \
[list command [tr "Copy"] {} [tr "Copy to Clipboard"] {Ctrl c} -command Editor::copy ]\
[list command [tr "Cut"] {} [tr "Cut to Clipboard"] {Ctrl x} -command Editor::cut ]\
[list command [tr "Paste"] {} [tr "Paste from Clipboard"] {Ctrl v} -command Editor::paste ]\
[list command [tr "Delete"] {} [tr "Delete Selection"] {} -command Editor::delete ]\
[list command [tr "Delete Line"] {} [tr "Delete current line"] {} -command {Editor::delLine ; break} ]\
{separator}\
[list command [tr "Select all"] {} [tr "Select All"] {} -command Editor::SelectAll ]\
{separator}\
[list command [tr "Insert File ..."] {} [tr "Insert file at current cursor position"] {} -command Editor::insertFile ]\
{separator}\
[list command [tr "Goto Line ..."] {} [tr "Goto Line"] {} -command Editor::gotoLineDlg ]\
{separator}\
[list command [tr "Search ..."] {} [tr "Search dialog"] {} -command Editor::search_dialog ]\
[list command [tr "Search in files ..."] {} [tr "Search in files"] {} -command Editor::findInFiles]\
[list command [tr "Replace ..."] {} [tr "Replace dialog"] {} -command Editor::replace_dialog ]\
{separator}\
[list command [tr "Undo"] {} [tr "Undo"] {CtrlAlt u} -command Editor::undo ]\
[list command [tr "Redo"] {} [tr "Redo"] {} -command Editor::redo ]\
{separator}\
[list command [tr "AutoIndent File"] {} [tr "AutoIndent current file"] {} -command editorWindows::autoIndent]\
]\
[tr "&Test"] {} {} 0 [list \
[list command [tr "Run"] {noFile} [tr "Test current File"] {CtrlAlt r} -command Editor::execFile ]\
[list command [tr "Stop"] {noFile} [tr "Terminate Execution of current File"] {CtrlAlt s} -command Editor::terminate ]\
{separator}\
[list command [tr "Set Default Startfile..."] {} [tr "Set Default Startfile"] {} -command Editor::setDefaultProject ]\
[list command [tr "Unset Default Startfile"] {} [tr "Unset Default Startfile"] {} -command {Editor::setDefaultProject "none"} ]\
{separator}\
[list command [tr "Set Startfile for current file..."] {noFile} [tr "Associate a Startfile to the current File"] {} -command Editor::associateProject ]\
[list command [tr "Unset Startfile for current file..."] {noFile} [tr "Clear current Startfile Association"] {} -command Editor::unsetProjectAssociation ]\
{separator}\
[list checkbutton [tr "Use EvalServer"] {all option} [tr "Use EvalServer for Testing Apps"] {} \
-variable Editor::options(useEvalServer) \
-command {set EditorData(options,useEvalServer) $Editor::options(useEvalServer)}\
]\
[list command [tr "Change Serverport ..."] {} [tr "Change Port for EvalServer"] {} -command {Editor::changeServerPort} ]\
[list command [tr "Choose Wish ..."] {} [tr "Choose Wish for EvalServer"] {} -command {Editor::chooseWish} ]\
]\
[tr "&Options"] all options 0 [list \
[list checkbutton [tr "Main Toolbar"] {all option} [tr "Show/hide Main Toolbar"] {} \
-variable Editor::toolbar1 \
-command {$Editor::mainframe showtoolbar 0 $Editor::toolbar1
set EditorData(options,showToolbar1) $Editor::toolbar1
}\
]\
[list checkbutton [tr "&Font Toolbar"] {all option} [tr "Show/hide Font Toolbar"] {} \
-variable Editor::toolbar2 \
-command {$Editor::mainframe showtoolbar 1 $Editor::toolbar2
set EditorData(options,showToolbar2) $Editor::toolbar2} \
]\
{separator}\
[list command [tr "Increase Fontsize"] {} [tr "Increase Fontsize"] {} -command {Editor::increaseFontSize up} ]\
[list command [tr "Decrease Fontsize"] {} [tr "Decrease Fontsize"] {} -command {Editor::increaseFontSize down} ]\
{separator}\
[list checkbutton [tr "Sort Code Browser Tree"] {all option} [tr "Sort Treenodes in Code Browser"] {} \
-variable Editor::options(sortProcs) \
-command {set editorData(options,sortProcs) $Editor::options(sortProcs)
Editor::toggleTreeOrder} \
]\
[list checkbutton [tr "Highlight current node"] {all option} [tr "Highlight current node in Code Browser"] {} \
-variable Editor::options(showProc) \
-command {set EditorData(options,showProc) $Editor::options(showProc)
catch {Editor::selectObject 0}} \
]\
[list checkbutton [tr "Auto Update"] {all option} [tr "Automatic Code Browser Update"] {} \
-variable Editor::options(autoUpdate) \
-command {set EditorData(options,autoUpdate) $Editor::options(autoUpdate)
catch {Editor::updateObjects}} \
]\
{separator}\
[list checkbutton [tr "Syntax &Highlighting"] {all option} [tr "Use Keyword Highlighting"] {} \
-variable Editor::options(useHL) \
-command {set EditorData(options,useHL) $Editor::options(useHL)
catch editorWindows::colorize} \
]\
[list checkbutton [tr "&Indent"] {all option} [tr "Use Indent"] {} \
-variable Editor::options(useIndent) \
-command {set EditorData(options,useIndent) $Editor::options(useIndent) } \
]\
[list checkbutton [tr "&SyntaxIndent"] {all option} [tr "Use Syntax Indent"] {} \
-variable Editor::options(useSI) \
-command {set EditorData(options,useSintaxIndent) $Editor::options(useSI) }\
]\
[list checkbutton [tr "Auto Completion for Keywords"] {all option} [tr "Use Templates for Keywords"] {} \
-variable Editor::options(useKeywordTemplates) \
-command {set EditorData(options,useTemplatesForKeywords) $Editor::options(useKeywordTemplates) }\
]\
[list checkbutton [tr "Auto Completion for \{"] {all option} [tr "Use Templates for Braces"] {} \
-variable Editor::options(useBracesTemplates) \
-command {set EditorData(options,useTemplatesForBrace) $Editor::options(useBracesTemplates) }\
]\
[list checkbutton [tr "Auto Completion for \("] {all option} [tr "Use Templates for Paren"] {} \
-variable Editor::options(useParenTemplates) \
-command {set EditorData(options,useTemplatesForParen) $Editor::options(useParenTemplates) }\
]\
[list checkbutton [tr "Auto Completion for \["] {all option} [tr "Use Templates for Bracket"] {}\
-variable Editor::options(useBracketTemplates) \
-command {set EditorData(options,useTemplatesForBracket) $Editor::options(useBracketTemplates) }\
]\
[list checkbutton [tr "Auto Completion for \""] {all option} [tr "Use Templates for DblQuotes"] {} \
-variable Editor::options(useQuotesTemplates) \
-command {set EditorData(options,useTemplatesForQuoteDbl) $Editor::options(useQuotesTemplates) }\
]\
{separator}\
[list checkbutton [tr "Change tabs into spaces"] {all option} [tr "Change tabs into spaces"] {} \
-variable Editor::options(changeTabs) \
-command {set EditorData(options,changeTabs) $Editor::options(changeTabs) }\
]\
[list checkbutton [tr "Use Default Extension"] {all option} [tr "Use Default Extension \".tcl\""] {} \
-variable Editor::options(useDefaultExtension) \
-command {set EditorData(options,useDefaultExtension) $Editor::options(useDefaultExtension) }\
]\
{separator}\
[list checkbutton [tr "Save/Restore Session"] {all option} [tr "Save/Restore Session"] {} \
-variable Editor::options(restoreSession) \
-command {set EditorData(options,restoreSession) $Editor::options(restoreSession) }\
]\
{separator}\
[list command [tr "Choose Language"] {} [tr "Choose Language"] {} -command {Editor::chooseLanguage} ]\
] \
[tr "&View"] all options 0 [list \
[list checkbutton [tr "Show Console"] {all option} [tr "Show Console Window"] {} \
-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}
} \
]\
[list checkbutton [tr "Show Code Browser"] {all option} [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}
} \
]\
[list checkbutton [tr "Solely Console"] {all option} [tr "Only Console Window"] {} \
-variable Editor::options(solelyConsole) \
-command {set EditorData(options,solelyConsole) $Editor::options(solelyConsole)
Editor::showSolelyConsole $EditorData(options,solelyConsole)
update idletasks
}\
]\
]\
[tr "&Help"] {} {} 0 [list \
[list command [tr "About"] {} [tr "About"] {} -command Editor::aboutBox ]\
]
]
}
proc Editor::createPopMenuTreeWindow {{update 0}} {
if {$update == 0} {
set Editor::treeMenu [menu .treemenu]
}
$Editor::treeMenu delete 1 end
$Editor::treeMenu add command -label [tr "Top"] \
-command {
$Editor::current(text) mark set insert 1.0
$Editor::current(text) see insert
}
$Editor::treeMenu add command -label [tr "Bottom"] \
-command {
$Editor::current(text) mark set insert end
$Editor::current(text) see insert
}
$Editor::treeMenu add command -label [tr "Last Line"] \
-command {
if {$Editor::current(node) != ""} {
set markName $Editor::current(node)
append markName "_end_of_proc"
$Editor::current(text) mark set insert $markName
$Editor::current(text) see insert
}
}
$Editor::treeMenu add separator
$Editor::treeMenu add checkbutton -label [tr "sort tree"] \
-variable Editor::options(sortProcs) \
-command {set editorData(options,sortProcs) $Editor::options(sortProcs)
Editor::toggleTreeOrder}
$Editor::treeMenu add separator
$Editor::treeMenu add command -label [tr "update tree"] \
-command {set cursor [. cget -cursor]
. configure -cursor watch
update
set updateState $EditorData(options,autoUpdate)
set EditorData(options,autoUpdate) 1
Editor::updateObjects
set EditorData(options,autoUpdate) $updateState
. configure -cursor $cursor
Editor::selectObject 0
update
}
}
proc Editor::createPopMenuEditorWindow {{update 0}} {
if {$update == 0} {
set Editor::textMenu [menu .textmenu]
}
$Editor::textMenu delete 1 end
$Editor::textMenu add command -label [tr "Cut"] -command Editor::cut
$Editor::textMenu add command -label [tr "Copy"] -command Editor::copy
$Editor::textMenu add command -label [tr "Paste"] -command Editor::paste
$Editor::textMenu add separator
$Editor::textMenu add command -label [tr "Undo"] -command Editor::undo
$Editor::textMenu add command -label [tr "Redo"] -command Editor::redo
$Editor::textMenu add separator
$Editor::textMenu add command -label [tr "Auto Indent Selection"] -command editorWindows::autoIndent
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -