Added insert base64 encoded image into source code
This commit is contained in:
@@ -694,6 +694,7 @@ proc EditFile {tree node fileName} {
|
||||
bind $text <Control-icircumflex> "auto_completition_proc $text"
|
||||
bind $text <Control-j> "auto_completition_proc $text"
|
||||
#bind $text <Control-Tab> "auto_completition_proc $text"
|
||||
bind $text <Control-i> "ImageBase64Encode $text"
|
||||
|
||||
bind $text <Control-q> Find
|
||||
bind $text <Control-comma> {TextOperation comment}
|
||||
@@ -933,7 +934,7 @@ proc ReadFileStructure {mod line lineNumber tree node} {
|
||||
global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG activeProject
|
||||
global varList
|
||||
set dot "_"
|
||||
|
||||
|
||||
# Insert procedure names into tree #
|
||||
regsub -all {\t} $line " " line
|
||||
set w $noteBook.f$node
|
||||
@@ -1001,3 +1002,5 @@ proc EditorFileNavigateMenu {w fullPathFile} {
|
||||
GetOp
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -622,5 +622,3 @@ proc FileOperation::FileDialog {tree operation} {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,6 +1,3 @@
|
||||
package require Img
|
||||
|
||||
|
||||
proc ImageViewer {f w node} {
|
||||
global tab_label noteBook factor im1 im2 editor
|
||||
set factor($node) 1.0
|
||||
@@ -22,7 +19,7 @@ proc ImageViewer {f w node} {
|
||||
#$w.scrwin setwidget $w.scrwin.f
|
||||
openImg $f $w.f.c $node
|
||||
set tab_label [$noteBook itemcget $node -text]
|
||||
balloon $w.f.c set "Mouse wheel up/down - verti<EFBFBD>al scrolling the image\n\
|
||||
balloon $w.f.c set "Mouse wheel up/down - vertiÓal scrolling the image\n\
|
||||
Shift + mouse wheel up/down - horizontal image scrolling\n\
|
||||
Control + mouse wheel up/down is a scale image -/+"
|
||||
}
|
||||
@@ -53,8 +50,23 @@ proc scale {w {n 1} node} {
|
||||
$w config -scrollregion [$w bbox all]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
proc ImageBase64Encode {text} {
|
||||
global env
|
||||
set types {
|
||||
{"GIF" {.gif}}
|
||||
{"JPEG" {.jpg}}
|
||||
{"PNG" {.png}}
|
||||
{"BMP" {.bmp}}
|
||||
{"All files" *}
|
||||
}
|
||||
set img [tk_getOpenFile -initialdir $env(HOME) -filetypes $types -parent .]
|
||||
set f [open $img]
|
||||
fconfigure $f -translation binary
|
||||
set data [base64::encode [read $f]]
|
||||
close $f
|
||||
# base name on root name of the image file
|
||||
set name [file root [file tail $img]]
|
||||
$text insert [Position] "image create photo $name -data {\n$data\n}"
|
||||
}
|
||||
|
||||
|
||||
|
@@ -367,3 +367,4 @@ if {[info exists workingProject]} {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
14
lib/menu.tcl
14
lib/menu.tcl
@@ -90,8 +90,18 @@ proc GetMenu {m} {
|
||||
$me add command -label [::msgcat::mc "KOI8-R"] -command {TextEncode koi8-r} -font $fontNormal
|
||||
$me add command -label [::msgcat::mc "CP1251"] -command {TextEncode cp1251} -font $fontNormal
|
||||
$me add command -label [::msgcat::mc "CP866"] -command {TextEncode cp866} -font $fontNormal
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Insert image"] -font $fontNormal -accelerator "Ctrl+I" \
|
||||
-command {
|
||||
set nb [$noteBook raise]
|
||||
if {$nb == "" || $nb == "newproj" || $nb == "about" || $nb == "debug"} {
|
||||
return
|
||||
}
|
||||
set nb "$noteBook.f$nb"
|
||||
ImageBase64Encode $nb.text
|
||||
unset nb
|
||||
}
|
||||
}
|
||||
|
||||
proc GetViewMenu {m} {
|
||||
global fontNormal fontBold imgDir editor
|
||||
$m add checkbutton -label [::msgcat::mc "Show the Menu"] -font $fontNormal -state normal\
|
||||
@@ -168,3 +178,5 @@ proc GetFileMenu {m} {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user