- Timestamp:
- 01/25/06 14:55:17 (3 years ago)
- Location:
- trunk/orca
- Files:
-
- 5 modified
-
ChangeLog (modified) (1 diff)
-
files.c (modified) (4 diffs)
-
qt/qorca.cpp (modified) (5 diffs)
-
unix/os.h (modified) (1 diff)
-
win32/os.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/orca/ChangeLog
r1 r2 4 4 V0.0.23 - ?? January 2005 5 5 6 * Foreach no longer creates a new context. Use 'rebol in config.r to 7 get the old behavior. 6 8 * Script header is now required. 7 9 * Implemented do/args. -
trunk/orca/files.c
r1 r2 248 248 if( a1->type == OT_FILE ) 249 249 { 250 int n; 250 251 const char* fn; 251 252 OString* str = orSTRING(a1); … … 254 255 255 256 fn = str->charArray + a1->series.index; 256 if( orIsDir( fn ) ) 257 n = orIsDir( fn ); 258 if( n < 0 ) 259 { 260 goto read_error; 261 } 262 else if( n == 1 ) 257 263 { 258 264 orReadDir( fn ); … … 280 286 FileHandle fp; 281 287 OString* buf; 282 int n;288 int err; 283 289 int size; 284 290 int skip = 0; … … 323 329 324 330 n = fileRead( fp, buf->buf, size ); 331 err = fileError( fp ); 325 332 fileClose( fp ); 326 333 327 if( n != size)334 if( err ) 328 335 { 336 read_error: 329 337 orErrorT( OR_ERROR_ACCESS, "read failed on %s", fn ); 330 338 return; 331 339 } 332 340 333 buf->used = size;341 buf->used = n; 334 342 orResultSeries( orRefineSet(REF_READ_BINARY) ? 335 343 OT_BINARY : OT_STRING, -
trunk/orca/qt/qorca.cpp
r1 r2 9 9 #include <QTabWidget> 10 10 #include <QMessageBox> 11 #include <QTextCursor> 11 12 #include "qorca.h" 12 13 #include "cbparse.h" … … 791 792 #define REF_RF_SAVE a1+1 792 793 #define REF_RF_DIR a1+2 794 #define REF_RF_INIT a1+3 795 #define REF_RF_PATH a1+4 793 796 794 797 static void requestFileNative( OValue* a1 ) 795 798 { 796 799 QString fn; 800 QString dir; 797 801 OString* str; 798 802 const char* cp; 799 803 804 if( orRefineSet( REF_RF_INIT ) ) 805 { 806 OValue* ref = REF_RF_PATH; 807 str = orSTRING( ref ); 808 orCTermStr( str ); 809 dir = orStrChars( str, ref ); 810 } 811 else 812 { 813 dir = qEnv.filePath; 814 } 815 800 816 str = orSTRING(a1); 801 cp = str->charArray + a1->series.index; 817 orCTermStr( str ); 818 cp = orStrChars( str, a1 ); 802 819 803 820 if( orRefineSet( REF_RF_DIR ) ) 804 821 { 805 fn = QFileDialog::getExistingDirectory(0, QString(cp), qEnv.filePath);822 fn = QFileDialog::getExistingDirectory(0, QString(cp), dir ); 806 823 } 807 824 else if( orRefineSet( REF_RF_SAVE ) ) 808 825 { 809 fn = QFileDialog::getSaveFileName( 0, QString(cp), qEnv.filePath);826 fn = QFileDialog::getSaveFileName( 0, QString(cp), dir ); 810 827 } 811 828 else 812 829 { 813 fn = QFileDialog::getOpenFileName( 0, QString(cp), qEnv.filePath);830 fn = QFileDialog::getOpenFileName( 0, QString(cp), dir ); 814 831 } 815 832 … … 967 984 968 985 986 static void appendTextNative( OValue* a1 ) 987 { 988 WIDPool::REC* rec = qEnv.pool.record( a1->integer ); 989 if( rec ) 990 { 991 const OValue* a2 = a1 + 1; 992 993 switch( rec->type ) 994 { 995 case WT_LineEdit: 996 { 997 QString cur; 998 QString txt; 999 valueToQString( a2, txt ); 1000 cur = ((QLineEdit*) rec->widget)->text(); 1001 cur.append( txt ); 1002 ((QLineEdit*) rec->widget)->setText( cur ); 1003 } 1004 break; 1005 1006 case WT_TextEdit: 1007 { 1008 QString txt; 1009 QTextCursor cursor; 1010 1011 valueToQString( a2, txt ); 1012 1013 QTextEdit* edit = (QTextEdit*) rec->widget; 1014 1015 cursor = edit->textCursor(); 1016 cursor.movePosition( QTextCursor::End ); 1017 cursor.insertText( txt ); 1018 1019 //edit->insertPlainText( txt ); 1020 //edit->append( txt ); // Adds linefeed before text. 1021 } 1022 break; 1023 1024 default: 1025 break; 1026 } 1027 } 1028 } 1029 1030 969 1031 static void messageNative( OValue* a1 ) 970 1032 { … … 1017 1079 "dialog: native [layout [block!]]\n" 1018 1080 "widget: native [layout [block!]]\n" 1019 "request-file: native [title [string!] /save /dir ]\n"1081 "request-file: native [title [string!] /save /dir /init path]\n" 1020 1082 "enable: native [wid [integer!]]\n" 1021 1083 "disable: native [wid [integer!]]\n" 1022 1084 "widget-value: native [wid [integer!]]\n" 1023 1085 "set-widget-value: native [wid [integer!] val]\n" 1086 "append-text: native [wid [integer!] val]\n" 1024 1087 "watch-dir: native [dir [string! file!] handler [block!]]\n" 1025 1088 "message: native [title [string!] msg [string!] /warn]\n" … … 1087 1150 orNative( (void*) widgetValueNative, "widget-value" ); 1088 1151 orNative( (void*) setWidgetValueNative, "set-widget-value" ); 1152 orNative( (void*) appendTextNative, "append-text" ); 1089 1153 orNative( (void*) messageNative, "message" ); 1090 1154 #ifdef DIR_WATCHER -
trunk/orca/unix/os.h
r1 r2 49 49 #define fileWrite(fh,buf,len) fwrite(buf,1,len,fh) 50 50 #define fileSeek(fh,off) fseek(fh,off,SEEK_SET) 51 #define fileError(fh) ferror(fh) 51 52 52 53 #ifdef __cplusplus -
trunk/orca/win32/os.h
r1 r2 49 49 #define fileWrite(fh,buf,len) fwrite(buf,1,len,fh) 50 50 #define fileSeek(fh,off) fseek(fh,off,SEEK_SET) 51 #define fileError(fh) ferror(fh) 51 52 52 53 #ifdef __cplusplus
