|
@@ -46,6 +46,135 @@ Editor::~Editor()
|
|
|
parser->release();
|
|
|
}
|
|
|
|
|
|
+// Verarbeitet ein Maus Ereignis. Wird vom Framework automatisch aufgerufen.
|
|
|
+// me: Das Ereignis
|
|
|
+void Editor::doMausEreignis( MausEreignis &me, bool userRet )
|
|
|
+{
|
|
|
+ if( hatStyleNicht( Style::Erlaubt ) || !userRet )
|
|
|
+ {
|
|
|
+ int rbr = 0;
|
|
|
+ if( rahmen )
|
|
|
+ rbr = rahmen->getRBreite();
|
|
|
+ if( ( ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ||
|
|
|
+ ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ) &&
|
|
|
+ me.mx > rbr && me.mx < gr.x - rbr &&
|
|
|
+ me.my > rbr && me.my < gr.y - rbr )
|
|
|
+ {
|
|
|
+ me.verarbeitet |= vertikalScrollBar->doMausMessage( gr.x - rbr - 15, rbr, 15, gr.y - rbr * 2, me );
|
|
|
+ me.verarbeitet |= horizontalScrollBar->doMausMessage( rbr, gr.y - rbr * 2 - 15, gr.x - rbr * 2 - ( ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? 15 : 0 ), 15, me );
|
|
|
+ }
|
|
|
+ mausKlick = 0;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if( !me.verarbeitet )
|
|
|
+ {
|
|
|
+ if( me.id == ME_Betritt )
|
|
|
+ mausKlick = 0;
|
|
|
+ int rbr = 0;
|
|
|
+ if( rahmen )
|
|
|
+ rbr = rahmen->getRBreite();
|
|
|
+ if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
+ {
|
|
|
+ if( vertikalScrollBar->doMausMessage( gr.x - rbr - 15, rbr, 15, gr.y - rbr * 2, me ) )
|
|
|
+ {
|
|
|
+ me.verarbeitet = 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
+ {
|
|
|
+ if( horizontalScrollBar->doMausMessage( rbr, gr.y - rbr - 15, gr.x - rbr * 2 - ( ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? 15 : 0 ), 15, me ) )
|
|
|
+ {
|
|
|
+ me.verarbeitet = 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( me.mx < gr.x - rbr - 15 )
|
|
|
+ {
|
|
|
+ if( textRd )
|
|
|
+ {
|
|
|
+ textRd->setSchriftSize( 12 );
|
|
|
+ bool shift = getTastenStand( T_Shift );
|
|
|
+ if( me.id == Framework::ME_PLinks )
|
|
|
+ {
|
|
|
+ int tbr = textRd->getTextBreite( script->getText() );
|
|
|
+ int thi = textRd->getTextHeight( script->getText() );
|
|
|
+ int scrollHi = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? vertikalScrollBar->getScroll() : 0;
|
|
|
+ int scrollBr = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ? horizontalScrollBar->getScroll() : 0;
|
|
|
+ int xxx = me.mx - rbr + scrollBr;
|
|
|
+ int yyy = me.my - rbr + scrollHi;
|
|
|
+ int scrollBreite = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) * 15;
|
|
|
+ int pos = textRd->textPos( script->getText(), xxx, yyy );
|
|
|
+ if( pos != -1 )
|
|
|
+ {
|
|
|
+ if( shift )
|
|
|
+ begF = pos;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cPos = pos;
|
|
|
+ begF = pos;
|
|
|
+ }
|
|
|
+ rend = 1;
|
|
|
+ if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
+ updateVScroll( begF );
|
|
|
+ if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
+ updateHScroll( begF );
|
|
|
+ }
|
|
|
+ mausKlick = 1;
|
|
|
+ }
|
|
|
+ if( me.id == ME_Bewegung && mausKlick )
|
|
|
+ {
|
|
|
+ int tbr = textRd->getTextBreite( script->getText() );
|
|
|
+ int thi = textRd->getTextHeight( script->getText() );
|
|
|
+ int scrollHi = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? vertikalScrollBar->getScroll() : 0;
|
|
|
+ int scrollBr = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ? horizontalScrollBar->getScroll() : 0;
|
|
|
+ int xxx = me.mx - rbr + scrollBr;
|
|
|
+ int yyy = me.my - rbr + scrollHi;
|
|
|
+ int scrollBreite = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) * 15;
|
|
|
+ int scrollHeight = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) * 15;
|
|
|
+ int pos = textRd->textPos( script->getText(), xxx, yyy );
|
|
|
+ if( pos != -1 )
|
|
|
+ {
|
|
|
+ if( begF != pos )
|
|
|
+ rend = 1;
|
|
|
+ begF = pos;
|
|
|
+ if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
+ updateVScroll( begF );
|
|
|
+ if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
+ updateHScroll( begF );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( me.id == ME_RLinks )
|
|
|
+ {
|
|
|
+ if( !shift )
|
|
|
+ {
|
|
|
+ int tbr = textRd->getTextBreite( script->getText() );
|
|
|
+ int thi = textRd->getTextHeight( script->getText() );
|
|
|
+ int scrollHi = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? vertikalScrollBar->getScroll() : 0;
|
|
|
+ int scrollBr = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ? horizontalScrollBar->getScroll() : 0;
|
|
|
+ int xxx = me.mx - rbr + scrollBr;
|
|
|
+ int yyy = me.my - rbr + scrollHi;
|
|
|
+ int scrollBreite = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) * 15;
|
|
|
+ int scrollHeight = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) * 15;
|
|
|
+ int pos = textRd->textPos( script->getText(), xxx, yyy );
|
|
|
+ if( pos != -1 )
|
|
|
+ {
|
|
|
+ begF = pos;
|
|
|
+ if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
+ updateVScroll( begF );
|
|
|
+ if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
+ updateHScroll( begF );
|
|
|
+ }
|
|
|
+ rend = 1;
|
|
|
+ }
|
|
|
+ mausKlick = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ me.verarbeitet = 1;
|
|
|
+}
|
|
|
+
|
|
|
void Editor::updateHScroll( int pos )
|
|
|
{
|
|
|
if( pos == -1 )
|
|
@@ -119,7 +248,7 @@ void Editor::updateVScroll( int pos )
|
|
|
|
|
|
// Setzt die zu verwendende Schrift
|
|
|
// s: Die Schrift
|
|
|
-void Editor::setSchriftZ( Schrift *s )
|
|
|
+void Editor::setSchriftZ( Schrift * s )
|
|
|
{
|
|
|
if( !textRd )
|
|
|
textRd = new TextRenderer( s );
|
|
@@ -129,7 +258,7 @@ void Editor::setSchriftZ( Schrift *s )
|
|
|
|
|
|
// Setzt den zu verwendenden Text Renderer
|
|
|
// t: Der Text Renderer
|
|
|
-void Editor::setTextRendererZ( TextRenderer *t )
|
|
|
+void Editor::setTextRendererZ( TextRenderer * t )
|
|
|
{
|
|
|
if( textRd )
|
|
|
textRd->release();
|
|
@@ -138,7 +267,7 @@ void Editor::setTextRendererZ( TextRenderer *t )
|
|
|
|
|
|
// Setzt den Text (das Script was verändert werden soll)
|
|
|
// txt: Der Text
|
|
|
-void Editor::setText( Text *txt )
|
|
|
+void Editor::setText( Text * txt )
|
|
|
{
|
|
|
lockZeichnung();
|
|
|
if( script )
|
|
@@ -154,7 +283,7 @@ void Editor::setText( Text *txt )
|
|
|
}
|
|
|
|
|
|
// Gibt den aktuellen Text zurück
|
|
|
-Text *Editor::zText() const
|
|
|
+Text * Editor::zText() const
|
|
|
{
|
|
|
return script;
|
|
|
}
|
|
@@ -185,206 +314,9 @@ bool Editor::getWarningDetection() const
|
|
|
return warningDetection;
|
|
|
}
|
|
|
|
|
|
-// Verarbeitet ein Maus Ereignis. Wird vom Framework automatisch aufgerufen.
|
|
|
-// me: Das Ereignis
|
|
|
-void Editor::doMausEreignis( MausEreignis &me )
|
|
|
-{
|
|
|
- bool nmakc = !me.verarbeitet;
|
|
|
- if( hatStyleNicht( Style::Erlaubt ) || hatStyleNicht( Style::Sichtbar ) )
|
|
|
- {
|
|
|
- if( toolTip )
|
|
|
- toolTip->setMausIn( 0 );
|
|
|
- me.mx -= pos.x, me.my -= pos.y;
|
|
|
- int rbr = 0;
|
|
|
- if( rahmen )
|
|
|
- rbr = rahmen->getRBreite();
|
|
|
- if( ( ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ||
|
|
|
- ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ) &&
|
|
|
- me.mx > rbr && me.mx < gr.x - rbr &&
|
|
|
- me.my > rbr && me.my < gr.y - rbr )
|
|
|
- {
|
|
|
- vertikalScrollBar->doMausMessage( gr.x - rbr - 15, rbr, 15, gr.y - rbr * 2, me );
|
|
|
- horizontalScrollBar->doMausMessage( rbr, gr.y - rbr * 2 - 15, gr.x - rbr * 2 - ( ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? 15 : 0 ), 15, me );
|
|
|
- me.verarbeitet = 1;
|
|
|
- }
|
|
|
- me.mx += pos.x, me.my += pos.y;
|
|
|
- mausKlick = 0;
|
|
|
- return;
|
|
|
- }
|
|
|
- bool removeFokus = 0;
|
|
|
- if( me.verarbeitet || !( me.mx >= pos.x && me.mx <= pos.x + gr.x && me.my >= pos.y && me.my <= pos.y + gr.y ) )
|
|
|
- {
|
|
|
- if( mausIn )
|
|
|
- {
|
|
|
- mausIn = 0;
|
|
|
- if( toolTip )
|
|
|
- toolTip->setMausIn( 0 );
|
|
|
- MausEreignis me2;
|
|
|
- me2.id = ME_Leaves;
|
|
|
- me2.mx = me.mx;
|
|
|
- me2.my = me.my;
|
|
|
- me2.verarbeitet = 0;
|
|
|
- doMausEreignis( me2 );
|
|
|
- return;
|
|
|
- }
|
|
|
- removeFokus = 1;
|
|
|
- }
|
|
|
- if( !( me.mx >= pos.x && me.mx <= pos.x + gr.x && me.my >= pos.y && me.my <= pos.y + gr.y ) && me.id != ME_Leaves )
|
|
|
- {
|
|
|
- if( removeFokus && me.id == ME_RLinks )
|
|
|
- {
|
|
|
- me.mx -= pos.x, me.my -= pos.y;
|
|
|
- if( hatStyle( Style::Fokus ) && mak && ( me.verarbeitet || mak( makParam, this, me ) ) )
|
|
|
- removeStyle( Style::Fokus );
|
|
|
- if( nmakc && me.verarbeitet && nMak )
|
|
|
- me.verarbeitet = nMak( nmakParam, this, me );
|
|
|
- me.mx += pos.x, me.my += pos.y;
|
|
|
- }
|
|
|
- if( toolTip )
|
|
|
- toolTip->setMausIn( 0 );
|
|
|
- return;
|
|
|
- }
|
|
|
- if( !mausIn && me.id != ME_Leaves )
|
|
|
- {
|
|
|
- mausIn = 1;
|
|
|
- if( toolTip )
|
|
|
- toolTip->setMausIn( 1 );
|
|
|
- MausEreignis me2;
|
|
|
- me2.id = ME_Betritt;
|
|
|
- me2.mx = me.mx;
|
|
|
- me2.my = me.my;
|
|
|
- me2.verarbeitet = 0;
|
|
|
- doMausEreignis( me2 );
|
|
|
- }
|
|
|
- me.mx -= pos.x, me.my -= pos.y;
|
|
|
- if( mak && ( me.verarbeitet || mak( makParam, this, me ) ) )
|
|
|
- {
|
|
|
- if( removeFokus && me.id == ME_RLinks )
|
|
|
- removeStyle( Style::Fokus );
|
|
|
- if( !me.verarbeitet )
|
|
|
- {
|
|
|
- if( hatStyleNicht( Style::Fokus ) )
|
|
|
- {
|
|
|
- mausKlick = 0;
|
|
|
- if( me.id == Framework::ME_PLinks )
|
|
|
- addStyle( Style::Fokus );
|
|
|
- }
|
|
|
- int rbr = 0;
|
|
|
- if( rahmen )
|
|
|
- rbr = rahmen->getRBreite();
|
|
|
- if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
- {
|
|
|
- if( vertikalScrollBar->doMausMessage( gr.x - rbr - 15, rbr, 15, gr.y - rbr * 2, me ) )
|
|
|
- {
|
|
|
- if( nmakc && me.verarbeitet && nMak )
|
|
|
- me.verarbeitet = nMak( nmakParam, this, me );
|
|
|
- me.mx += pos.x, me.my += pos.y;
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
- {
|
|
|
- if( horizontalScrollBar->doMausMessage( rbr, gr.y - rbr - 15, gr.x - rbr * 2 - ( ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? 15 : 0 ), 15, me ) )
|
|
|
- {
|
|
|
- if( nmakc && me.verarbeitet && nMak )
|
|
|
- me.verarbeitet = nMak( nmakParam, this, me );
|
|
|
- me.mx += pos.x, me.my += pos.y;
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- if( me.mx < gr.x - rbr - 15 )
|
|
|
- {
|
|
|
- if( textRd )
|
|
|
- {
|
|
|
- textRd->setSchriftSize( 12 );
|
|
|
- bool shift = getTastenStand( T_Shift );
|
|
|
- if( me.id == Framework::ME_PLinks )
|
|
|
- {
|
|
|
- int tbr = textRd->getTextBreite( script->getText() );
|
|
|
- int thi = textRd->getTextHeight( script->getText() );
|
|
|
- int scrollHi = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? vertikalScrollBar->getScroll() : 0;
|
|
|
- int scrollBr = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ? horizontalScrollBar->getScroll() : 0;
|
|
|
- int xxx = me.mx - rbr + scrollBr;
|
|
|
- int yyy = me.my - rbr + scrollHi;
|
|
|
- int scrollBreite = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) * 15;
|
|
|
- int pos = textRd->textPos( script->getText(), xxx, yyy );
|
|
|
- if( pos != -1 )
|
|
|
- {
|
|
|
- if( shift )
|
|
|
- begF = pos;
|
|
|
- else
|
|
|
- {
|
|
|
- cPos = pos;
|
|
|
- begF = pos;
|
|
|
- }
|
|
|
- rend = 1;
|
|
|
- if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
- updateVScroll( begF );
|
|
|
- if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
- updateHScroll( begF );
|
|
|
- }
|
|
|
- mausKlick = 1;
|
|
|
- }
|
|
|
- if( me.id == ME_Bewegung && mausKlick )
|
|
|
- {
|
|
|
- int tbr = textRd->getTextBreite( script->getText() );
|
|
|
- int thi = textRd->getTextHeight( script->getText() );
|
|
|
- int scrollHi = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? vertikalScrollBar->getScroll() : 0;
|
|
|
- int scrollBr = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ? horizontalScrollBar->getScroll() : 0;
|
|
|
- int xxx = me.mx - rbr + scrollBr;
|
|
|
- int yyy = me.my - rbr + scrollHi;
|
|
|
- int scrollBreite = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) * 15;
|
|
|
- int scrollHeight = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) * 15;
|
|
|
- int pos = textRd->textPos( script->getText(), xxx, yyy );
|
|
|
- if( pos != -1 )
|
|
|
- {
|
|
|
- if( begF != pos )
|
|
|
- rend = 1;
|
|
|
- begF = pos;
|
|
|
- if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
- updateVScroll( begF );
|
|
|
- if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
- updateHScroll( begF );
|
|
|
- }
|
|
|
- }
|
|
|
- if( me.id == ME_RLinks )
|
|
|
- {
|
|
|
- if( !shift )
|
|
|
- {
|
|
|
- int tbr = textRd->getTextBreite( script->getText() );
|
|
|
- int thi = textRd->getTextHeight( script->getText() );
|
|
|
- int scrollHi = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) ? vertikalScrollBar->getScroll() : 0;
|
|
|
- int scrollBr = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) ? horizontalScrollBar->getScroll() : 0;
|
|
|
- int xxx = me.mx - rbr + scrollBr;
|
|
|
- int yyy = me.my - rbr + scrollHi;
|
|
|
- int scrollBreite = ( vertikalScrollBar && hatStyle( Style::VScroll ) ) * 15;
|
|
|
- int scrollHeight = ( horizontalScrollBar && hatStyle( Style::HScroll ) ) * 15;
|
|
|
- int pos = textRd->textPos( script->getText(), xxx, yyy );
|
|
|
- if( pos != -1 )
|
|
|
- {
|
|
|
- begF = pos;
|
|
|
- if( vertikalScrollBar && hatStyle( Style::VScroll ) )
|
|
|
- updateVScroll( begF );
|
|
|
- if( horizontalScrollBar && hatStyle( Style::HScroll ) )
|
|
|
- updateHScroll( begF );
|
|
|
- }
|
|
|
- rend = 1;
|
|
|
- }
|
|
|
- mausKlick = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- me.verarbeitet = 1;
|
|
|
- }
|
|
|
- if( nmakc && me.verarbeitet && nMak )
|
|
|
- me.verarbeitet = nMak( nmakParam, this, me );
|
|
|
- me.mx += pos.x, me.my += pos.y;
|
|
|
-}
|
|
|
-
|
|
|
// Verarbeitet ein Tastatur Ereignis. Wird vom Framework automatisch aufgerufen
|
|
|
// te: Das Ereignis
|
|
|
-void Editor::doTastaturEreignis( TastaturEreignis &te )
|
|
|
+void Editor::doTastaturEreignis( TastaturEreignis & te )
|
|
|
{
|
|
|
bool ntakc = !te.verarbeitet;
|
|
|
if( te.verarbeitet || hatStyleNicht( Style::Fokus ) )
|
|
@@ -600,7 +532,7 @@ bool Editor::tick( double tickval )
|
|
|
if( tickVal >= 1 )
|
|
|
{
|
|
|
lockZeichnung();
|
|
|
- if( (reloadCounter -= 2 ) <= 0 )
|
|
|
+ if( ( reloadCounter -= 2 ) <= 0 )
|
|
|
{
|
|
|
zm.messungStart();
|
|
|
parser->reload();
|
|
@@ -615,7 +547,7 @@ bool Editor::tick( double tickval )
|
|
|
}
|
|
|
|
|
|
// Zeichnet den Editor nach rObj
|
|
|
-void Editor::render( Bild &rObj )
|
|
|
+void Editor::render( Bild & rObj )
|
|
|
{
|
|
|
if( hatStyleNicht( Style::Sichtbar ) )
|
|
|
return;
|
|
@@ -646,7 +578,7 @@ void Editor::render( Bild &rObj )
|
|
|
{
|
|
|
if( !parser )
|
|
|
return colors[ KSGScriptEditor::ColorType::NORMAL_TEXT ];
|
|
|
- int uC = -1;
|
|
|
+ int uC = -1;
|
|
|
int tC = colors[ parser->getNextColor( pos, uC ) ];
|
|
|
if( uC >= 0 )
|
|
|
rObj.drawLinieH( x, y + 12, 12, colors[ uC ] );
|