X-Git-Url: https://git.dlugolecki.net.pl/?p=vlp.git;a=blobdiff_plain;f=edit%2Feditor.cpp;h=ed71939e4ede9ddab0d62c92198384364bcffedf;hp=f7ef8207f998cab311f277af1ccd77a3d0f610c9;hb=e702805740237c3ce3bc4c5de9466d3f0d630595;hpb=9db87b545def5d31a64608f2eb082d915ad5efa4 diff --git a/edit/editor.cpp b/edit/editor.cpp index f7ef820..ed71939 100644 --- a/edit/editor.cpp +++ b/edit/editor.cpp @@ -34,9 +34,13 @@ Editor *e; char *UnitTypes[5] = {"CLASS","PROCEDURE","FUNCTION","PROCESS","COROUTINE"}; -My_Edit::My_Edit(QWidget *parent=0,const char *name=0) + + +My_Edit::My_Edit(QWidget *parent,const char *name) : QMultiLineEdit(parent,name) { + parent = NULL; + name = NULL; } void My_Edit::keyPressEvent(QKeyEvent *ev) @@ -46,10 +50,14 @@ void My_Edit::keyPressEvent(QKeyEvent *ev) } +void Editor::closeEvent ( QCloseEvent * e ) { + e->ignore(); +} + Editor::Editor( char *hdir,QWidget * parent , const char * name) : QWidget( parent, name ) { - QFont f1("Helvetica",12,QFont::Bold); + QFont f1("Helvetica",10,QFont::Bold); strcpy(HomeDir,hdir); @@ -96,7 +104,7 @@ Editor::Editor( char *hdir,QWidget * parent , const char * name) e = new My_Edit( this, "editor" ); connect(e,SIGNAL(cursorMove()),this,SLOT(updateline())); - medit->insertItem("Copy ",e,SLOT(copyText()),CTRL+Key_Insert); + medit->insertItem("Copy ",e,SLOT(copy()),CTRL+Key_Insert); medit->insertItem("Paste ",e,SLOT(paste()), SHIFT+Key_Insert); medit->insertItem("Cut ",e,SLOT(cut()), CTRL+Key_Delete); medit->insertItem("Clear All ",e,SLOT(clear())); @@ -221,7 +229,7 @@ void Editor::save(const char *fileName) QFile f(fileName); if (!f.open(IO_WriteOnly)) return; f.reset(); - f.writeBlock( e->text().data(),e->text().size() ); + f.writeBlock( e->text().data(),e->text().length() ); f.close(); @@ -381,9 +389,9 @@ void Editor::props() if (dlg.exec()) { - compiler_path.sprintf("%s",compp->text()); + compiler_path.sprintf("%s",compp->text().ascii()); // gen_path.sprintf("%s",genp->text()); - file_path.sprintf("%s",files->text()); + file_path.sprintf("%s",files->text().ascii()); }; } @@ -447,7 +455,7 @@ void Editor::log_unit() e->getCursorPosition(&cx,&cy); txt.sprintf("UNIT %s : %s( );\nBEGIN\n\nEND %s;",uname, - lst.text(lst.currentItem()), uname); + lst.text(lst.currentItem()).ascii(), uname); e->insertAt(txt,cx,cy); }; } @@ -520,7 +528,7 @@ void Editor::findText() { QFont font( "helvetica", 12, 75, 0 ); font.setStyleHint( (QFont::StyleHint)0 ); - font.setCharSet( (QFont::CharSet)0 ); + //font.setCharSet( (QFont::CharSet)0 ); tmpQLabel->setFont( font ); } tmpQLabel->setText( "Text:" ); @@ -587,7 +595,7 @@ void Editor::find_next() int main( int argc, char **argv ) { QApplication a( argc, argv ); - a.setStyle(WindowsStyle); + //a.setStyle(WindowsStyle); e = new Editor(argv[1]); e->resize( 600, 400 ); e->show();