Browse Source

improved keybord events

Kolja Strohm 1 year ago
parent
commit
2063a2b4ed
14 changed files with 113 additions and 240 deletions
  1. 1 1
      AuswahlBox.cpp
  2. 5 0
      Bild.cpp
  3. 18 173
      Fenster.cpp
  4. 1 1
      Fenster.h
  5. 9 13
      Global.cpp
  6. 0 6
      Globals.h
  7. 1 0
      HashMap.h
  8. 4 1
      JSON.cpp
  9. 28 11
      Liste.cpp
  10. 4 4
      Tabelle.cpp
  11. 9 9
      TastaturEreignis.cpp
  12. 3 1
      TastaturEreignis.h
  13. 22 20
      TextFeld.cpp
  14. 8 0
      Zeichnung.cpp

+ 1 - 1
AuswahlBox.cpp

@@ -956,7 +956,7 @@ void AuswahlBox::doTastaturEreignis( TastaturEreignis &te ) // Tastatur
         return;
     if( te.id == TE_Release )
     {
-        switch( te.taste )
+        switch( te.virtualKey )
         {
         case T_Oben:
             if( auswahl > 0 )

+ 5 - 0
Bild.cpp

@@ -1130,6 +1130,7 @@ void Bild::drawLinie(Punkt a, Punkt b, int fc) // zeichnet eine Linie von Punkt(
 			this->fc[(int)((int)(x + 0.5) + (int)(y + 0.5) * size.x)] = fc;
 			x += xf, y += yf;
 		}
+		this->fc[(int)((int)(x + 0.5) + (int)(y + 0.5) * size.x)] = fc;
 		rend = 1;
 	}
 }
@@ -1223,6 +1224,10 @@ void Bild::drawLinieAlpha(Punkt a, Punkt b, int fc)
 				(pixel & 0xFF000000)) * (pixel != 0 || !alpha3D) | (pixel == 0 && alpha3D) * fc;
 			x += xf, y += yf;
 		}
+		int& pixel = this->fc[(int)(x + 0.5) + (int)(y + 0.5) * size.x];
+		pixel = (((((na * (pixel & 0xFF00FF)) >> 8) + i1) & 0xFF00FF) |
+			((((na * (pixel & 0x00FF00)) >> 8) + i2) & 0x00FF00) |
+			(pixel & 0xFF000000)) * (pixel != 0 || !alpha3D) | (pixel == 0 && alpha3D) * fc;
 		rend = 1;
 	}
 }

+ 18 - 173
Fenster.cpp

@@ -203,18 +203,16 @@ LRESULT CALLBACK Framework::WindowProc(HWND hwnd, UINT message, WPARAM wparam, L
 	case WM_KEYDOWN:
 		if (1)
 		{
-			TastaturEreignis te = { TE_Press, VirtualZuChar((int)wparam), 0 };
-			if (te.taste == T_Alt_Gr)
-				TastenStand[T_Strg] = 0;
-			TastenStand[te.taste] = 1;
+			TastaturEreignis te = { TE_Press, {0, 0, 0}, 0, 0 };
+			CalculateEnteredString((int)wparam, 0, te);
 			WFensterA.sendTastaturMessage(hwnd, te);
 			break;
 		} // Taste wird gedrückt
 	case WM_KEYUP:
 		if (1)
 		{
-			TastaturEreignis te = { TE_Release, VirtualZuChar((int)wparam), 0 };
-			TastenStand[te.taste] = 0;
+			TastaturEreignis te = { TE_Release, {0, 0, 0}, 0, 0 };
+			CalculateEnteredString((int)wparam, HIWORD(lparam) & 0xFF, te);
 			WFensterA.sendTastaturMessage(hwnd, te);
 			break;
 		} // Taste wird losgelassen
@@ -242,146 +240,23 @@ void Framework::StopNachrichtenSchleife(HWND hwnd)
 	PostMessage(hwnd, WM_MOUSELEAVE, 0, 0);
 }
 
-unsigned char Framework::VirtualZuChar(int Virtual)
+void Framework::CalculateEnteredString(int virtualKeyCode, int scanCode, TastaturEreignis &te)
 {
-	UINT vk = MapVirtualKey(Virtual, 2);
-	if (!vk)
+	memset(te.taste, 0, sizeof(te.taste));
+	te.virtualKey = virtualKeyCode;
+#ifdef WIN32
+	unsigned char keyState[256];
+	memset(keyState, 0, sizeof(keyState));
+	if (GetKeyboardState(keyState))
 	{
-		switch (Virtual)
-		{
-		case VK_CAPITAL:
-			return T_Caps_Lock;
-		case VK_SHIFT:
-			return T_Shift;
-		case VK_CONTROL:
-			return T_Strg;
-		case VK_F1:
-			return T_F1;
-		case VK_F2:
-			return T_F2;
-		case VK_F3:
-			return T_F3;
-		case VK_F4:
-			return T_F4;
-		case VK_F5:
-			return T_F5;
-		case VK_F6:
-			return T_F6;
-		case VK_F7:
-			return T_F7;
-		case VK_F8:
-			return T_F8;
-		case VK_F9:
-			return T_F9;
-		case VK_F10:
-			return T_F10;
-		case VK_F11:
-			return T_F11;
-		case VK_F12:
-			return T_F12;
-		case VK_PAUSE:
-			return T_Pause;
-		case VK_SNAPSHOT:
-			return T_Druck;
-		case VK_INSERT:
-			return T_Einfg;
-		case VK_DELETE:
-			return T_Entf;
-		case VK_LEFT:
-			return T_Links;
-		case VK_UP:
-			return T_Oben;
-		case VK_RIGHT:
-			return T_Rechts;
-		case VK_DOWN:
-			return T_Unten;
-		case VK_MENU:
-			return T_Alt_Gr;
-		case VK_NUMLOCK:
-			return T_Num;
-		case VK_HOME:
-			return T_Pos1;
-		case VK_PRIOR:
-			return T_BildO;
-		case VK_NEXT:
-			return T_BildU;
-		case VK_END:
-			return T_Ende;
-		case VK_TAB:
-			return T_Tab;
-		case VK_LMENU:
-			return T_Alt;
-		}
+		unsigned short str[2] = { 0, 0 };
+		int count = ToAscii(virtualKeyCode, scanCode, keyState, str, 0);
+		if (count == 1 && (str[0] & 0xFF) == str[0])
+			te.taste[0] = (unsigned char)str[0];
+		else if (count == 2 && (str[0] & 0xFF) == str[0] && (str[1] & 0xFF) == str[1])
+			te.taste[0] = (unsigned char)str[0], te.taste[1] = (unsigned char)str[1];
 	}
-	if (vk == VK_TAB)
-		return T_Tab;
-	char ret = (char)(short)LOWORD(vk);
-	short SHIFT = GetKeyState(VK_SHIFT);
-	short CAPSLOCK = GetKeyState(VK_CAPITAL);
-	short ALTGR = TastenStand[T_Alt_Gr];
-	if (ALTGR)
-	{
-		switch (ret)
-		{
-		case 'q':
-			return '@';
-		case 'Q':
-			return '@';
-		case '<':
-			return '|';
-		case '>':
-			return '|';
-		case '7':
-			return '{';
-		case '/':
-			return '{';
-		case '8':
-			return '[';
-		case '(':
-			return '[';
-		case '9':
-			return ']';
-		case ')':
-			return ']';
-		case '0':
-			return '}';
-		case '=':
-			return '}';
-		case 'ß':
-			return '\\';
-		case '?':
-			return '\\';
-		case '+':
-			return '~';
-		case '*':
-			return '~';
-		case 'e':
-			return '€';
-		case 'E':
-			return '€';
-		case 'm':
-			return 'µ';
-		case 'M':
-			return 'µ';
-		case '2':
-			return '²';
-		case '"':
-			return '²';
-		case '3':
-			return '³';
-		case '§':
-			return '³';
-		}
-	}
-	SHIFT = HIWORD(SHIFT);
-	CAPSLOCK = LOWORD(CAPSLOCK);
-	bool up = 0;
-	if (SHIFT && !CAPSLOCK)
-		up = 1;
-	if (CAPSLOCK && !SHIFT)
-		up = 1;
-	ret = smallOrBig(ret, up);
-	return ret;
+#endif // WIN32
 }
 
 // Inhalt der WFenster Klasse aus Fenster.h
@@ -508,16 +383,6 @@ void WFenster::setPosition(int x, int y)
 	RECT res;
 	res.left = x, res.top = y, res.right = r.right - r.left, res.bottom = r.bottom - r.top;
 	AdjustWindowRect(&res, style, 0);
-	/*    if( res.top < 0 )
-		{
-			res.bottom -= res.top;
-			res.top = 0;
-		}
-		if( res.left < 0 )
-		{
-			res.right -= res.left;
-			res.left = 0;
-		}*/
 	SetWindowPos(hWnd, 0, res.left, res.top, res.right, res.bottom, 0); // Position ändern
 }
 
@@ -528,16 +393,6 @@ void WFenster::setSize(Punkt& g)// Fenster Gr
 	RECT res;
 	res.left = r.left, res.top = r.top, res.right = g.x, res.bottom = g.y;
 	AdjustWindowRect(&res, style, 0);
-	/*    if( res.top < 0 )
-		{
-			res.bottom -= res.top;
-			res.top = 0;
-		}
-		if( res.left < 0 )
-		{
-			res.right -= res.left;
-			res.left = 0;
-		}*/
 	SetWindowPos(hWnd, 0, res.left, res.top, res.right, res.bottom, 0); // Größe ändern
 }
 
@@ -548,16 +403,6 @@ void WFenster::setSize(int breite, int h
 	RECT res;
 	res.left = r.left, res.top = r.top, res.right = breite, res.bottom = höhe;
 	AdjustWindowRect(&res, style, 0);
-	/*    if( res.top < 0 )
-		{
-			res.bottom -= res.top;
-			res.top = 0;
-		}
-		if( res.left < 0 )
-		{
-			res.right -= res.left;
-			res.left = 0;
-		}*/
 	SetWindowPos(hWnd, 0, res.left, res.top, res.right, res.bottom, 0); // Größe ändern
 }
 

+ 1 - 1
Fenster.h

@@ -33,7 +33,7 @@ namespace Framework
 	//! \param hwnd Ein Handle auf ein beliebiges Fenster des Frameworks, das Nachrichten empfangen kann. Wird benötigt, um eine Nachricht zu senden, damit die funktion StartNachrichtenSchleife nicht mehr wartet und sofort beendet wird
 	DLLEXPORT void StopNachrichtenSchleife(HWND hwnd);
 	//! Übersetzt einen Keycode, der von Windows gesendet wurde in den Buchstaben der gedrückten Taste
-	DLLEXPORT unsigned char VirtualZuChar(int Virtual);
+	DLLEXPORT void CalculateEnteredString(int virtualKeyCode, int scanCode, TastaturEreignis& te);
 
 	//! Klasse für ein Fenster der Windows API
 	class WFenster : public virtual ReferenceCounter

+ 9 - 13
Global.cpp

@@ -29,8 +29,6 @@ void Framework::initFramework(HINSTANCE__* hInst)
 	msgExit = 0;
 	MausTrack = 1;
 #endif
-	for (int i = 0; i < 255; ++i)
-		TastenStand[i] = 0;
 	for (int i = 0; i < 3; ++i)
 		MausStand[i] = 0;
 	TexturList::init();
@@ -88,19 +86,17 @@ bool Framework::getMausStand(int taste)
 	return MausStand[taste];
 }
 
-void Framework::setTastenStand(unsigned char taste, bool st)
-{
-	TastenStand[taste] = st;
-	if (!st)
-	{
-		TastenStand[(unsigned char)smallOrBig((char)taste, 0)] = st;
-		TastenStand[(unsigned char)smallOrBig((char)taste, 1)] = st;
-	}
-}
-
 bool Framework::getTastenStand(unsigned char taste)
 {
-	return TastenStand[taste];
+#ifdef WIN32
+	unsigned char keyState[256];
+	memset(keyState, 0, sizeof(keyState));
+	if (!GetKeyboardState(keyState))
+		return 0;
+	return keyState[taste] & 0x80;
+#else
+	return 0;
+#endif
 }
 
 // Legt fest ob Log Nachrichten gespeichert werden sollen

+ 0 - 6
Globals.h

@@ -28,7 +28,6 @@ namespace Framework
 	Global Maus MausZeiger;
 	Global bool msgExit;
 #endif
-	Global bool TastenStand[255];
 	Global bool MausStand[3];
 	Global bool istInitialisiert;
 	Global ThreadRegister* thRegister;
@@ -53,11 +52,6 @@ namespace Framework
 	//! \param taste Die Taste, die überprüft werden soll
 	//! Beispiel: getTastenStand( T_Enter ); (Benötogt include <TastaturEreignis.h>
 	DLLEXPORT bool getTastenStand(unsigned char taste);
-	//! Legt fest, ob eine Taste auf der tastatur momentan gedrückt wird
-	//! Der Tastenstand wird vom Framework selbst verwaltet und muss nicht mit dieser Funktion gesetzt werden
-	//! \param taste Die Taste, deren Status gesetzt werden soll
-	//! \param st Ob die Taste momentan gedrückt wird. (true), wenn ja. (false) sonnst.
-	DLLEXPORT void setTastenStand(unsigned char taste, bool st);
 	//! Initialisiert das Framework
 	//! Wird in der (WinMain) des Frameworks automatisch aufgerufen
 	DLLEXPORT void initFramework(HINSTANCE__* hInst = 0);

+ 1 - 0
HashMap.h

@@ -65,6 +65,7 @@ namespace Framework
 				this->bucketIndex = 0;
 				this->buckets = 0;
 				this->bucketCount = 0;
+				return;
 			}
 			this->buckets = buckets;
 			this->bucketCount = bucketCount;

+ 4 - 1
JSON.cpp

@@ -422,7 +422,10 @@ JSONValue* JSON::loadJSONFromFile(Text path)
 {
 	Datei d;
 	d.setDatei(path);
-	d.open(Datei::Style::lesen);
+	if (!d.open(Datei::Style::lesen))
+	{
+		return new JSONValue();
+	}
 	int size = (int)d.getSize();
 	char* buffer = new char[size + 1];
 	buffer[size] = 0;

+ 28 - 11
Liste.cpp

@@ -87,8 +87,8 @@ void AuswahlListe::doMausEreignis(MausEreignis& me, bool userRet)
 			}
 			else
 			{
-				bool shift = TastenStand[T_Shift];
-				bool strg = TastenStand[T_Strg];
+				bool shift = getTastenStand(T_Shift);
+				bool strg = getTastenStand(T_Strg);
 				if (strg)
 				{
 					setMsStyle(eintr, Style::Selected, hatMsStyleNicht(eintr, Style::Selected));
@@ -541,7 +541,7 @@ void AuswahlListe::doTastaturEreignis(TastaturEreignis& te)
 		{
 			if (hatStyleNicht(Style::MultiSelect))
 			{
-				switch (te.taste)
+				switch (te.virtualKey)
 				{
 				case T_Unten:
 					++auswahl;
@@ -559,7 +559,7 @@ void AuswahlListe::doTastaturEreignis(TastaturEreignis& te)
 			}
 			else
 			{
-				switch (te.taste)
+				switch (te.virtualKey)
 				{
 				case T_Unten:
 					deSelect();
@@ -996,6 +996,17 @@ ZListe::~ZListe()
 //! \param me Das Ereignis, was durch die Tastatureingabe ausgelößt wurde
 void ZListe::doMausEreignis(MausEreignis& me, bool userRet)
 {
+	if (ZeichnungHintergrund::hatStyle(Style::VScroll) && vertikalScrollBar)
+	{
+		int rbr = 0;
+		if (rahmen && ZeichnungHintergrund::hatStyle(Style::Rahmen))
+			rbr = rahmen->getRBreite();
+		if (((me.mx > gr.x - 15 - rbr) || me.id == ME_UScroll || me.id == ME_DScroll) && me.id != ME_Betritt && me.id != ME_Leaves)
+		{
+			vertikalScrollBar->doMausMessage(gr.x - rbr - 15, rbr, 15, gr.y - rbr * 2, me);
+			me.verarbeitet = 1;
+		}
+	}
 	me.my -= (rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0;
 	me.mx -= (rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0;
 	int ySum = 0;
@@ -1020,6 +1031,7 @@ void ZListe::doMausEreignis(MausEreignis& me, bool userRet)
 //! \param entry Die Zeichnung die hinzugefügt werden soll
 void ZListe::addEintrag(Zeichnung* entry)
 {
+	rend = 1;
 	list.add(entry);
 }
 
@@ -1028,6 +1040,7 @@ void ZListe::addEintrag(Zeichnung* entry)
 //! \param entry Die neue Zeichnung
 void ZListe::setEintrag(int pos, Zeichnung* entry)
 {
+	rend = 1;
 	list.set(entry, pos);
 }
 
@@ -1036,6 +1049,7 @@ void ZListe::setEintrag(int pos, Zeichnung* entry)
 //! \param npos Der Index des zweiten Eintrags
 void ZListe::tauschEintragPos(int vPos, int nPos)
 {
+	rend = 1;
 	list.tausch(vPos, nPos);
 }
 
@@ -1043,6 +1057,7 @@ void ZListe::tauschEintragPos(int vPos, int nPos)
 //! pos: Der Index des Eintrags
 void ZListe::removeEintrag(int pos)
 {
+	rend = 1;
 	list.remove(pos);
 }
 
@@ -1109,23 +1124,25 @@ bool ZListe::tick(double tickVal)
 void ZListe::render(Bild& rObj)
 {
 	ZeichnungHintergrund::render(rObj);
-	int ySum = 0;
 	int index = 0;
 	int rbr = rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen) ? rahmen->getRBreite() : 0;
 	bool vs = vertikalScrollBar && hatStyle(Style::VScroll);
-	if (rObj.setDrawOptions(pos + Punkt(rbr, rbr), gr - Punkt(rbr, rbr) * 2 - Punkt(0, vs ? 15 : 0)))
+	if (rObj.setDrawOptions(pos + Punkt(rbr, rbr), gr - Punkt(rbr, rbr) * 2 - Punkt(vs ? 15 : 0, 0)))
 	{
 		if(vs)
 			rObj.addScrollOffset(0, vertikalScrollBar->getScroll());
 		for (Zeichnung* entry : list)
 		{
+			entry->setWidth(gr.x - rbr * 2 - (vs ? 15 : 0));
 			entry->render(rObj);
-			ySum += entry->getHeight();
-			rObj.addScrollOffset(0, entry->getHeight());
-			if (index < list.getLastIndex())
+			rObj.addScrollOffset(0, -entry->getHeight());
+			if (index < list.getLastIndex() && ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator))
 			{
-				ySum += ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
-				rObj.addScrollOffset(0, ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0);
+				for (int i = 0; i < entrySeperatorSize; i++)
+				{
+					rObj.drawLinieHAlpha(0, 0, gr.x - rbr - (vs ? 15 : 0), entrySeperatorColor);
+					rObj.addScrollOffset(0, -1);
+				}
 			}
 			index++;
 		}

+ 4 - 4
Tabelle.cpp

@@ -1017,22 +1017,22 @@ void ObjTabelle::doTastaturEreignis( TastaturEreignis &te )
             zZeichnung( selected.x, selected.y )->doTastaturEreignis( te );
             if( !te.verarbeitet && te.id == TE_Press )
             {
-                if( te.taste == T_Oben )
+                if( te.virtualKey == T_Oben )
                 {
                     --( selected.y );
                     rend = 1;
                 }
-                if( te.taste == T_Unten )
+                if( te.virtualKey == T_Unten )
                 {
                     ++( selected.y );
                     rend = 1;
                 }
-                if( te.taste == T_Links )
+                if( te.virtualKey == T_Links )
                 {
                     --( selected.x );
                     rend = 1;
                 }
-                if( te.taste == T_Rechts )
+                if( te.virtualKey == T_Rechts )
                 {
                     ++( selected.x );
                     rend = 1;

+ 9 - 9
TastaturEreignis.cpp

@@ -7,28 +7,28 @@ bool Framework::_ret1TE( void *param, void *obj, TastaturEreignis te )
     return 1;
 }
 
-bool Framework::_nurNummernTE( void *param, void *obj, TastaturEreignis te )
+bool Framework::_nurNummernTE(void* param, void* obj, TastaturEreignis te)
 {
-    if( te.taste >= '0' && te.taste <= '9' )
+    if (te.taste[0] >= '0' && te.taste[0] <= '9')
         return 1;
-    if( te.taste == T_Entf || te.taste == T_BackSpace )
+    if( te.virtualKey == T_Entf || te.virtualKey == T_BackSpace )
         return 1;
-    if( te.taste == T_Links || te.taste == T_Rechts || te.taste == T_Unten || te.taste == T_Oben )
+    if( te.virtualKey == T_Links || te.virtualKey == T_Rechts || te.virtualKey == T_Unten || te.virtualKey == T_Oben )
         return 1;
     return 0;
 }
 
 bool Framework::_nurHexTE( void *param, void *obj, TastaturEreignis te )
 {
-    if( te.taste >= '0' && te.taste <= '9' )
+    if( te.taste[0] >= '0' && te.taste[0] <= '9' )
         return 1;
-    if( te.taste >= 'A' && te.taste <= 'F' )
+    if( te.taste[0] >= 'A' && te.taste[0] <= 'F' )
         return 1;
-    if( te.taste >= 'a' && te.taste <= 'f' )
+    if( te.taste[0] >= 'a' && te.taste[0] <= 'f' )
         return 1;
-    if( te.taste == T_Entf || te.taste == T_BackSpace )
+    if( te.virtualKey == T_Entf || te.virtualKey == T_BackSpace )
         return 1;
-    if( te.taste == T_Links || te.taste == T_Rechts || te.taste == T_Unten || te.taste == T_Oben )
+    if( te.virtualKey == T_Links || te.virtualKey == T_Rechts || te.virtualKey == T_Unten || te.virtualKey == T_Oben )
         return 1;
     return 0;
 }

+ 3 - 1
TastaturEreignis.h

@@ -90,7 +90,9 @@ namespace Framework
 		//! Art der Eingabe
 		int id;
 		//! Betroffene Taste
-		unsigned char taste;
+		char taste[3];
+		//! virtual key code
+		int virtualKey;
 		//! (true), wenn die Eingabe bereits verarbeitet wurde. (false) sonnst
 		bool verarbeitet;
 	};

+ 22 - 20
TextFeld.cpp

@@ -323,8 +323,8 @@ void TextFeld::doMausEreignis(MausEreignis& me, bool userRet) // Maus Ereignis
 				return;
 			}
 		}
-		bool shift = TastenStand[T_Shift];
-		bool strg = TastenStand[T_Strg];
+		bool shift = getTastenStand(T_Shift);
+		bool strg = getTastenStand(T_Strg);
 		int tbr = getTextWidth();
 		int thi = getTextHeight();
 		int scrollHi = (vertikalScrollBar && hatStyle(Style::VScroll)) ? vertikalScrollBar->getScroll() : 0;
@@ -1210,9 +1210,9 @@ void TextFeld::doTastaturEreignis(TastaturEreignis& te)
 		}
 		if (te.id == TE_Press)
 		{
-			bool shift = TastenStand[T_Shift];
-			bool strg = TastenStand[T_Strg];
-			switch (te.taste)
+			bool shift = getTastenStand(T_Shift);
+			bool strg = getTastenStand(T_Strg);
+			switch (te.virtualKey)
 			{
 			case T_Entf:
 				if (!tm->getTextStyle(cpos).selected)
@@ -1244,17 +1244,20 @@ void TextFeld::doTastaturEreignis(TastaturEreignis& te)
 				rend = 1;
 				break;
 			case T_Enter:
-				if (!tm->getTextStyle(cpos).selected)
-					tm->insertText(cpos, "\n");
-				else
+				if (hatStyle(TextFeld::Style::Mehrzeilig))
 				{
-					cpos = tm->getTextStyle(cpos).beginIndex;
-					while (cpos > 0 && tm->getTextStyle(cpos - 1).selected)
-						cpos = tm->getTextStyle(cpos - 1).beginIndex;
+					if (!tm->getTextStyle(cpos).selected)
+						tm->insertText(cpos, "\n");
+					else
+					{
+						cpos = tm->getTextStyle(cpos).beginIndex;
+						while (cpos > 0 && tm->getTextStyle(cpos - 1).selected)
+							cpos = tm->getTextStyle(cpos - 1).beginIndex;
+					}
+					replaceAuswahl("\n");
+					++cpos;
+					rend = 1;
 				}
-				replaceAuswahl("\n");
-				++cpos;
-				rend = 1;
 				break;
 			case T_Links:
 				if (shift)
@@ -1329,7 +1332,7 @@ void TextFeld::doTastaturEreignis(TastaturEreignis& te)
 			default:
 				if (strg && te.id == TE_Press)
 				{
-					if (te.taste == 'c' || te.taste == 'C')
+					if (te.virtualKey == 'c' || te.virtualKey == 'C')
 					{
 						int sa = tm->textStyle.getEintragAnzahl();
 						int length = 0;
@@ -1367,7 +1370,7 @@ void TextFeld::doTastaturEreignis(TastaturEreignis& te)
 						else
 							TextKopieren(tm->text->getText());
 					}
-					if (te.taste == 'v' || te.taste == 'V')
+					if (te.virtualKey == 'v' || te.virtualKey == 'V')
 					{
 						char* txt = TextInsert();
 						if (!tm->getTextStyle(cpos).selected)
@@ -1384,18 +1387,17 @@ void TextFeld::doTastaturEreignis(TastaturEreignis& te)
 					}
 					break;
 				}
-				if (istSchreibbar(te.taste))
+				if (istSchreibbar(te.taste[0]))
 				{
-					char buff[] = { (char)te.taste, 0 };
 					if (!tm->getTextStyle(cpos).selected)
-						tm->insertText(cpos, buff);
+						tm->insertText(cpos, te.taste);
 					else
 					{
 						cpos = tm->getTextStyle(cpos).beginIndex;
 						while (cpos > 0 && tm->getTextStyle(cpos - 1).selected)
 							cpos = tm->getTextStyle(cpos - 1).beginIndex;
 					}
-					replaceAuswahl(buff);
+					replaceAuswahl(te.taste);
 					++cpos;
 					rend = 1;
 				}

+ 8 - 0
Zeichnung.cpp

@@ -286,12 +286,20 @@ void Zeichnung::setSize(int x, int y) // setzt die Gr
 
 void Zeichnung::setWidth(int width)
 {
+	lockZeichnung();
+	if (this->gr.x != width)
+		rend = 1;
 	gr.x = width;
+	unlockZeichnung();
 }
 
 void Zeichnung::setHeight(int height)
 {
+	lockZeichnung();
+	if (this->gr.y != height)
+		rend = 1;
 	gr.y = height;
+	unlockZeichnung();
 }
 
 bool Zeichnung::tick(double tickval)