SCM

SCM Repository

[rqda] Diff of /pkg/R/FileButton.R
ViewVC logotype

Diff of /pkg/R/FileButton.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 73, Sat Mar 28 03:47:06 2009 UTC revision 74, Wed Apr 1 16:27:34 2009 UTC
# Line 216  Line 216 
216     viewFileAttr()     viewFileAttr()
217    }    }
218  }  }
219    FileNamesWidgetMenu$"Find a word..."$handler <- function(h, ...) {
220      if (is_projOpen(env=.rqda,conName="qdacon")) {
221        content <- tryCatch(svalue(RQDA:::.rqda$.openfile_gui),error=function(e){NULL})
222        if (!is.null(content)) {
223          word <- ginput("Type the word you intend to find.",con=TRUE)
224          Encoding(content) <- Encoding(word) <- "UTF-8"
225          idx1 <- gregexpr(word,content)[[1]] -1
226          idx2 <- idx1 + attr(idx1,"match.length")
227          idx <- data.frame(idx1,idx2)
228          ClearMark(.rqda$.openfile_gui,0,nchar(content),FALSE,TRUE)
229          HL(.rqda$.openfile_gui,idx,NULL,"yellow")
230        }
231      }
232    }
233  FileNamesWidgetMenu$"File Memo"$handler <- function(h,...){  FileNamesWidgetMenu$"File Memo"$handler <- function(h,...){
234   if (is_projOpen(env=.rqda,conName="qdacon")) {   if (is_projOpen(env=.rqda,conName="qdacon")) {
235   MemoWidget("File",.rqda$.fnames_rqda,"source")   MemoWidget("File",.rqda$.fnames_rqda,"source")
# Line 233  Line 247 
247      }      }
248      }      }
249    }    }
250  FileNamesWidgetMenu$"Show Uncoded Files Only (Sorted)"$handler <- function(h, ...) {  FileNamesWidgetMenu$"Show ..."$"Show Uncoded Files Sorted by Imported time"$handler <- function(h, ...) {
251      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
252        ## UncodedFileNamesUpdate(FileNamesWidget = .rqda$.fnames_rqda)        ## UncodedFileNamesUpdate(FileNamesWidget = .rqda$.fnames_rqda)
253        FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="uncoded"))        FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="uncoded"))
254        ## By default, the file names in the widget will be sorted.        ## By default, the file names in the widget will be sorted.
255      }      }
256    }    }
257  FileNamesWidgetMenu$"Show Coded Files Only (Sorted)"$handler <- function(h,...){  FileNamesWidgetMenu$"Show ..."$"Show Coded Files Sorted by Imported time"$handler <- function(h,...){
258    if (is_projOpen(env=.rqda,conName="qdacon")) {    if (is_projOpen(env=.rqda,conName="qdacon")) {
259      FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="coded"))      FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="coded"))
260    }    }
261  }  }
262  FileNamesWidgetMenu$"Show All Sorted By Imported Time"$handler <- function(h, ...) {  FileNamesWidgetMenu$"Show ..."$"Show All Sorted By Imported Time"$handler <- function(h, ...) {
263      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
264       ##FileNamesUpdate(FileNamesWidget=.rqda$.fnames_rqda)       ##FileNamesUpdate(FileNamesWidget=.rqda$.fnames_rqda)
265       FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="all"))       FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="all"))
266      }      }
267    }    }
268  FileNamesWidgetMenu$"Show Files With Memo"$handler <- function(h, ...) {  FileNamesWidgetMenu$"Show ..."$"Show Files With Memo"$handler <- function(h, ...) {
269      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
270      fileid <- dbGetQuery(.rqda$qdacon,"select id from source where memo is not null")      fileid <- dbGetQuery(.rqda$qdacon,"select id from source where memo is not null")
271      if (nrow(fileid)!=0) {      if (nrow(fileid)!=0) {
# Line 260  Line 274 
274      } else gmessage("No file with memo.",con=TRUE)      } else gmessage("No file with memo.",con=TRUE)
275      }      }
276    }    }
277  FileNamesWidgetMenu$"Show Files Without Memo"$handler <- function(h, ...) {  FileNamesWidgetMenu$"Show ..."$"Show Files Without Memo"$handler <- function(h, ...) {
278      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {      if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
279      fileid <- dbGetQuery(.rqda$qdacon,"select id from source where memo is null")      fileid <- dbGetQuery(.rqda$qdacon,"select id from source where memo is null")
280      if (nrow(fileid)!=0) {      if (nrow(fileid)!=0) {
# Line 269  Line 283 
283      } else gmessage("No file is found.",con=TRUE)      } else gmessage("No file is found.",con=TRUE)
284      }      }
285    }    }
286  FileNamesWidgetMenu$"Find a word..."$handler <- function(h, ...) {  
   if (is_projOpen(env=.rqda,conName="qdacon")) {  
     content <- tryCatch(svalue(RQDA:::.rqda$.openfile_gui),error=function(e){NULL})  
     if (!is.null(content)) {  
       word <- ginput("Type the word you intend to find.",con=TRUE)  
       Encoding(content) <- Encoding(word) <- "UTF-8"  
       idx1 <- gregexpr(word,content)[[1]] -1  
       idx2 <- idx1 + attr(idx1,"match.length")  
       idx <- data.frame(idx1,idx2)  
       ClearMark(.rqda$.openfile_gui,0,nchar(content),FALSE,TRUE)  
       HL(.rqda$.openfile_gui,idx,NULL,"yellow")  
     }  
   }  
 }  

Legend:
Removed from v.73  
changed lines
  Added in v.74

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge