Changeset 2 for trunk/orca/qt/qorca.cpp
- Timestamp:
- 01/25/06 14:55:17 (3 years ago)
- Files:
-
- 1 modified
-
trunk/orca/qt/qorca.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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
