Browse Source

Add files via upload

Capitan Cloud 1 year ago
parent
commit
0a0f28ed6a
4 changed files with 58 additions and 10 deletions
  1. BIN
      icons/file-css.png
  2. BIN
      icons/image.png
  3. 16 8
      radxide.tcl
  4. 42 2
      tree.tcl

BIN
icons/file-css.png


BIN
icons/image.png


+ 16 - 8
radxide.tcl

@@ -135,14 +135,18 @@ namespace eval radxide {
   set icons(HTML-ICONI) [image create photo imgobj5 -file $icons(HTML-ICON)]
   set icons(JS-ICON) "icons/file-js.png"
   set icons(JS-ICONI) [image create photo imgobj6 -file $icons(JS-ICON)]  
+  set icons(IMG-ICON) "icons/image.png"
+  set icons(IMG-ICONI) [image create photo imgobj7 -file $icons(IMG-ICON)]
+  set icons(CSS-ICON) "icons/file-css.png"
+  set icons(CSS-ICONI) [image create photo imgobj8 -file $icons(CSS-ICON)]
   set icons(PHP-ICON) "icons/file-php.png"
-  set icons(PHP-ICONI) [image create photo imgobj7 -file $icons(PHP-ICON)]
+  set icons(PHP-ICONI) [image create photo imgobj9 -file $icons(PHP-ICON)]
   set icons(TXT-ICON) "icons/file-txt.png"
-  set icons(TXT-ICONI) [image create photo imgobj8 -file $icons(TXT-ICON)]
+  set icons(TXT-ICONI) [image create photo imgobj10 -file $icons(TXT-ICON)]
   set icons(GENERIC-FILE-ICON) "icons/file-generic.png"
-  set icons(GENERIC-FILE-ICONI) [image create photo imgobj9 -file $icons(GENERIC-FILE-ICON)]
+  set icons(GENERIC-FILE-ICONI) [image create photo imgobj11 -file $icons(GENERIC-FILE-ICON)]
   set icons(FOLDER-ICON) "icons/folder.png"
-  set icons(FOLDER-ICONI) [image create photo imgobj10 -file $icons(FOLDER-ICON)]
+  set icons(FOLDER-ICONI) [image create photo imgobj12 -file $icons(FOLDER-ICON)]
   
   # Menu variables
   set menu(ROOT) "";
@@ -156,10 +160,14 @@ namespace eval radxide {
   set menu(CUT_ENTRY_IDX) 2;
   set menu(FIND_ENTRY_IDX) 4;    
     
-  set dan(PhpExts) {.php .php2 .php3 .php4 .php5 .funny}     ;# extensions of php files
-  set dan(HtmlExts) {.html .htm}                             ;# extensions of html files
-  set dan(JsExts) {.js}                                      ;# extensions of js files
-  set dan(TxtExts) {.txt .rtf}                               ;# extensions of txt files
+  set dan(PhpExts) {.php .php2 .php3 .php4 .php5 .funny .inc}     ;# extensions of php files
+  set dan(HtmlExts) {.html .htm}                                  ;# extensions of html files
+  set dan(CssExts) {.css}                                         ;# extensions of css files
+  set dan(JsExts) {.js}                                           ;# extensions of js files
+  set dan(CssExts) {.css}                                         ;# extensions of css files
+  set dan(TxtExts) {.txt .rtf}                                    ;# extensions of txt files
+  set dan(ImgExts) {.gif .png .jpg .jpeg}                         ;# extensions of images
+  set dan(BinExts) {.so .o .exe}                                  ;# extensions of binary
      
 # __________________ iswindows ___________________ #
 

+ 42 - 2
tree.tcl

@@ -295,12 +295,16 @@ namespace eval tree {
 		  
 		    if {[isHtml $fname]} {
 		      set imgopt $icons(HTML-ICONI)
+		    } elseif {[isCss $fname]} {
+		      set imgopt $icons(CSS-ICONI)		      
 		    } elseif {[isJs $fname]} {
 		      set imgopt $icons(JS-ICONI)		      
 		    } elseif {[isPhp $fname]} {
 		      set imgopt $icons(PHP-ICONI)
 		    } elseif {[isTxt $fname]} {
-		      set imgopt $icons(TXT-ICONI)		      		      
+		      set imgopt $icons(TXT-ICONI)
+		    } elseif {[isImage $fname]} {
+		      set imgopt $icons(IMG-ICONI)		      
 		    } else {
 		      set imgopt $icons(GENERIC-FILE-ICONI)
 		    }
@@ -541,6 +545,42 @@ namespace eval tree {
 		return no
 	}
 
+# ________________________ isCss _________________________ #
+
+	proc isCss {fname} {
+		# Checks if a file is of Css.
+		#   fname - file name
+
+		if {[string tolower [file extension $fname]] in $radxide::dan(CssExts)} {
+		  return yes
+		}
+		return no
+	}
+
+# ________________________ isBin _________________________ #
+
+	proc isBin {fname} {
+		# Checks if a file is of isBin.
+		#   fname - file name
+
+		if {[string tolower [file extension $fname]] in $radxide::dan(BinExts)} {
+		  return yes
+		}
+		return no
+	}
+
+# ________________________ isImage _________________________ #
+
+	proc isImage {fname} {
+		# Checks if a file is of Image.
+		#   fname - file name
+
+		if {[string tolower [file extension $fname]] in $radxide::dan(ImgExts)} {
+		  return yes
+		}
+		return no
+	}
+
 # ________________________ isJs _________________________ #
 
 	proc isJs {fname} {
@@ -601,7 +641,7 @@ namespace eval tree {
 		  if {[set ID [$tree selection]] eq {}} return
 		}
 		lassign [$tree item $ID -values] -> fname isfile
-		if {$isfile} {
+		if {$isfile && (![isBin $fname]) && (![isImage $fname])} {
 		  $dan(TEXT) config -state normal
 		  $dan(TEXT) delete 1.0 end 
 		  $dan(TEXT) insert 1.0 [::radxide::filelib::openFile $fname]