[tuhopuu-devel] tabcomplete improve
Joilnen Batista Leite
tuhopuu-devel@blender.org
Mon, 12 Jul 2004 14:54:02 -0700 (PDT)
--0-251527659-1089669242=:51411
Content-Type: text/plain; charset=us-ascii
Content-Id:
Content-Disposition: inline
I am using blender instead tuhopuu2 but i will change
it for tuhopuu too .
thanks to consider
Joilnen Batista Leite
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--0-251527659-1089669242=:51411
Content-Type: text/plain; name="tabpatch.blender1"
Content-Description: tabpatch.blender1
Content-Disposition: inline; filename="tabpatch.blender1"
--- blender/source/blender/src/header_image.c 2004-07-04 11:40:48.000000000 -0300
+++ blender_old/source/blender/src/header_image.c 2004-07-11 20:16:13.000000000 -0300
@@ -571,6 +571,7 @@
activate_imageselect(FILE_SPECIAL, "Open Image", name, load_space_image);
else
activate_fileselect(FILE_SPECIAL, "Open Image", name, load_space_image);
+ ((SpaceFile*) curarea->spacedata.first)->filetype = IMAGEFILE;
break;
case 1: /* Replace */
if(G.sima->image) strcpy(name, G.sima->image->name);
--- blender/source/blender/src/filesel.c 2004-06-16 08:34:45.000000000 -0300
+++ blender_old/source/blender/src/filesel.c 2004-07-12 11:20:52.000000000 -0300
@@ -133,6 +133,7 @@
static void filesel_select_objects(struct SpaceFile *sfile);
static void active_file_object(struct SpaceFile *sfile);
static int groupname_to_code(char *group);
+static short my_strspn(char *d, char *s);
/* local globals */
@@ -2605,3 +2606,74 @@
}
}
+int find_filename(int ext){
+ SpaceFile *sfile;
+ short a, flag=0, c=0, tmp=0, tmp_ini=0;
+ struct direntry *file;
+
+ sfile = curarea->spacedata.first;
+
+ if( !sfile->filelist )
+ return 0;
+ file = sfile->filelist;
+ for(a=0; a<sfile->totfile; a++, file++) {
+ if( (!S_ISDIR(file->type) && ((strstr(file->relname, sfile->file) == file->relname)) ||
+ (!S_ISDIR(file->type) && (flag == 1)) ) ){
+ /* if ext != 0 press TAB scan only supported files types */
+ if(ext){
+
+ if( sfile->filetype == BLENDERFILE && file->flags != BLENDERFILE )
+ continue;
+ if( sfile->filetype == FTFONTFILE && file->flags != FTFONTFILE )
+ continue;
+ if( sfile->filetype == MOVIEFILE && file->flags != MOVIEFILE )
+ continue;
+ if( sfile->filetype == SOUNDFILE && file->flags != SOUNDFILE )
+ continue;
+ if( sfile->filetype == IMAGEFILE && file->flags != IMAGEFILE )
+ continue;
+ if( sfile->filetype == PYSCRIPTFILE &&
+ ( (file->flags != PYSCRIPTFILE) && !BLI_testextensie(file->relname, ".txt") )
+ )
+ continue;
+ }
+
+ if(!flag){
+ tmp = strlen(sfile->file);
+ tmp_ini = tmp;
+ strcpy(sfile->file, file->relname);
+ flag = 1;
+ continue;
+ }
+
+ /* return identic n of chars */
+ c = my_strspn(sfile->file, file->relname);
+ if(c && (c>=tmp || c>=tmp_ini)){
+
+ /* take last pattern */
+ strncpy(sfile->file, file->relname, c);
+ *(sfile->file+c) = '\0';
+ tmp = c;
+ }else if(flag == 1) break;
+ }
+
+ if(tmp){
+
+ /* keep right pattern */
+ strncpy(sfile->file, file->relname, tmp);
+ *(sfile->file+tmp) = '\0';
+ }
+ }
+ return 1;
+}
+
+static short my_strspn(char *d, char *s){
+ short count = 0;
+ while(*d && *s && *d==*s){
+ d++;
+ s++;
+ count++;
+ }
+ return count;
+}
+
--- blender/source/blender/src/header_sound.c 2004-03-25 22:12:45.000000000 -0300
+++ blender_old/source/blender/src/header_sound.c 2004-07-11 21:06:30.000000000 -0300
@@ -101,6 +101,7 @@
else strcpy(name, U.sounddir);
activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name,
load_space_sound);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = SOUNDFILE;
} else {
nr= 1;
id= (ID *)G.ssound->sound;
@@ -138,6 +139,7 @@
if (id) strcpy(name, ((bSound *)id)->name);
else strcpy(name, U.sounddir);
activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name, load_sound_buttons);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = SOUNDFILE;
}
else {
nr= 1;
--- blender/source/blender/src/toets.c 2004-06-16 17:25:56.000000000 -0300
+++ blender_old/source/blender/src/toets.c 2004-07-11 07:19:07.000000000 -0300
@@ -541,6 +541,7 @@
}
activate_fileselect(FILE_BLENDER, "Open File", G.sce, BIF_read_file);
+ ((SpaceFile*)curarea->spacedata.first)->filetype= BLENDERFILE;
return 0;
}
else if(G.qual==LR_SHIFTKEY) {
--- blender/source/blender/src/drawtext.c 2004-07-04 11:40:47.000000000 -0300
+++ blender_old/source/blender/src/drawtext.c 2004-07-12 09:43:19.000000000 -0300
@@ -1003,6 +1003,7 @@
break;
case 1:
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
break;
}
}
@@ -1018,6 +1019,7 @@
break;
case 1:
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
break;
}
}
@@ -1036,6 +1038,7 @@
else if (event==OKEY) {
if (G.qual & LR_ALTKEY) {
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
}
}
}
@@ -1074,6 +1077,7 @@
case 1:
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
break;
case 3:
@@ -1163,6 +1167,7 @@
break;
case 1:
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
break;
case 3:
text->flags |= TXT_ISMEM;
@@ -1209,6 +1214,7 @@
case OKEY:
if (G.qual == LR_ALTKEY) {
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
}
break; /* BREAK O */
case PKEY:
--- blender/source/blender/src/header_text.c 2004-03-25 22:12:45.000000000 -0300
+++ blender_old/source/blender/src/header_text.c 2004-07-12 09:44:54.000000000 -0300
@@ -112,6 +112,7 @@
}
else if (st->menunr==32766) {
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
return;
}
else {
@@ -126,6 +127,7 @@
if(idtest==0) { /* new text */
activate_fileselect(FILE_SPECIAL, "Open Text File",
G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
return;
}
if(idtest!=id) {
@@ -202,6 +204,7 @@
break;
case 2:
activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = PYSCRIPTFILE;
break;
case 3:
if (text->compiled) BPY_free_compiled_text(text);
--- blender/source/blender/src/editseq.c 2004-06-27 13:00:11.000000000 -0300
+++ blender_old/source/blender/src/editseq.c 2004-07-11 21:25:00.000000000 -0300
@@ -1031,10 +1031,12 @@
case 1:
activate_fileselect(FILE_SPECIAL, "Select Images", last_imagename, add_image_strips);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = IMAGEFILE;
break;
case 102:
activate_fileselect(FILE_SPECIAL, "Select Movie", last_imagename, add_movie_strip);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = MOVIEFILE;
break;
case 101:
/* new menu: */
@@ -1101,6 +1103,7 @@
case 103:
if (!last_sounddir[0]) strcpy(last_sounddir, U.sounddir);
activate_fileselect(FILE_SPECIAL, "Select Wav", last_sounddir, add_sound_strip);
+ ((SpaceFile *) curarea->spacedata.first)->filetype = SOUNDFILE;
break;
}
}
--- blender/source/blender/src/header_info.c 2004-07-04 11:40:49.000000000 -0300
+++ blender_old/source/blender/src/header_info.c 2004-07-11 08:25:18.000000000 -0300
@@ -822,6 +822,7 @@
break;
case 1: /* open */
activate_fileselect(FILE_BLENDER, "Open", G.sce, BIF_read_file);
+ ((SpaceFile*)curarea->spacedata.first)->filetype= BLENDERFILE;
break;
case 2: /* reopen last */
{
--- blender/source/blender/include/BSE_filesel.h 2003-07-17 11:19:55.000000000 -0300
+++ blender_old/source/blender/include/BSE_filesel.h 2004-07-10 13:12:32.000000000 -0300
@@ -59,5 +59,6 @@
void main_to_filelist(struct SpaceFile *sfile);
void clever_numbuts_filesel(void);
+int find_filename(int ext);
#endif
--- blender/source/blender/src/interface.c 2004-07-11 11:30:08.000000000 -0300
+++ blender_old/source/blender/src/interface.c 2004-07-10 13:12:32.000000000 -0300
@@ -1270,6 +1268,19 @@
}
}
break;
+ case TABKEY:
+ if(G.qual & LR_SHIFTKEY){
+ if(find_filename(0)) {
+ but->pos=len= strlen(str);
+ dodraw= 1;
+ }
+ }
+ else
+ if(find_filename(1)) {
+ but->pos=len= strlen(str);
+ dodraw= 1;
+ }
+
}
}
--- blender/source/blender/makesdna/DNA_space_types.h 19 Apr 2004 22:05:36 -0000 1.19
+++ blender/source/blender/makesdna/DNA_space_types.h 12 Jul 2004 20:01:34 -0000
@@ -164,6 +164,8 @@
short retval, ipotype;
short menu, act;
+ unsigned int filetype;
+ int pad1;
/* changed type for compiling */
/* void (*returnfunc)(short); ? used with char* ....*/
/**
--0-251527659-1089669242=:51411--