From f84f133f7c5afb610cd82bc3c95fe43ee9c0efc0 Mon Sep 17 00:00:00 2001 From: Ray-V Date: Mon, 1 Mar 2021 13:09:18 +0900 Subject: [PATCH] Added less-than (<) and greater-than (>) keys near left shift for non-US keyboards. Adjusted keyboard geometry accordingly. Signed-off-by: Ray-V Signed-off-by: Michele Calgaro --- src/MainWidget.cpp | 61 +++++++++++++++++++++++++--------------------- src/VButton.cpp | 2 +- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp index ee9c1df..da0fd0b 100644 --- a/src/MainWidget.cpp +++ b/src/MainWidget.cpp @@ -44,7 +44,7 @@ #define R1LEN 13 #define R2LEN 10 #define R3LEN 9 -#define R4LEN 7 +#define R4LEN 8 bool shutting=false; @@ -66,9 +66,9 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const //TQString k3s="ASDFGHJKL"; unsigned int kc3[R3LEN] = {38,39,40,41,42,43,44,45,46}; //,{47,48}; - //TQString k4="zxcvbnm"; //,./"; - //TQString k4s="ZXCVBNM"; - unsigned int kc4[R4LEN] = {52,53,54,55,56,57,58};//59,60,61}; + //TQString k4="setKeyCode ( 67+a ); f->setText ( "F"+TQString ( "%1" ).arg ( a+1 ) ); - f->move ( stx+esc->width() + ( 35*a ) +20,sty ); + f->move ( stx+esc->width() + ( 35*a ) +30,sty ); f->res(); other_keys.append(f); connect ( f,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); @@ -106,7 +106,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const VButton *f = new VButton ( this,"" ); f->setKeyCode ( 71+a ); f->setText ( "F"+TQString ( "%1" ).arg ( a+5 ) ); - f->move ( stx+esc->width() + ( 35*a ) +40+ ( 4*35 ),sty ); + f->move ( stx+esc->width() + ( 35*a ) +44+ ( 4*35 ),sty ); f->res(); other_keys.append(f); connect ( f,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); @@ -117,7 +117,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const f->setKeyCode ( 75+a ); if ( a>1 ) f->setKeyCode ( 93+a ); f->setText ( "F"+TQString ( "%1" ).arg ( a+9 ) ); - f->move ( stx+esc->width() + ( 35*a ) +45+ ( 8*35 ) +10,sty ); + f->move ( stx+esc->width() + ( 35*a ) +58+ ( 8*35 ),sty ); f->res(); other_keys.append(f); connect ( f,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); @@ -138,7 +138,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const VButton *bksp = new VButton ( this,"" ); bksp->setKeyCode ( 22 ); bksp->move ( stx+ ( R1LEN *35 ),sty+35 ); - bksp->resize ( 46,30 ); + bksp->resize ( 48,30 ); bksp->setText ( "Bksp" ); bksp->res(); other_keys.append(bksp); @@ -148,7 +148,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const VButton *tab = new VButton ( this,"" ); tab->setKeyCode ( 23 ); tab->move ( stx,sty+35+35 ); - tab->resize ( 47,30 ); + tab->resize ( 48,30 ); tab->setText ( "Tab" ); tab->res(); other_keys.append(tab); @@ -248,7 +248,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const lshft = new VButton ( this,"" ); lshft->setKeyCode ( 50 ); lshft->move ( stx,sty+ ( 4*35 ) ); - lshft->resize ( 80,30 ); + lshft->resize ( 45,30 ); lshft->setText ( "Shift" ); lshft->setToggleButton ( true ); connect ( lshft,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShift() ) ); @@ -261,7 +261,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const v->setKeyCode ( kc4[a] ); //v->setText ( k4.mid ( a,1 ) ); //v->setShiftText ( k4s.mid ( a,1 ) ); - v->move ( stx+35+16+35+ ( 35*a ),sty+ ( 4*35 ) ); + v->move ( stx+lshft->width() +5+ ( 35*a ),sty+ ( 4*35 ) ); btns.append ( v ); v->res(); connect ( v,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); @@ -304,6 +304,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const mod_keys.append ( rshft ); rshft->res(); + //ROW 5 lctrl = new VButton ( this,"" ); lctrl->resize ( 45,30 ); lctrl->move ( stx, sty+ ( 5*35 ) ); @@ -333,7 +334,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const VButton *space = new VButton ( this,"" ); space->setKeyCode ( 65 ); - space->resize ( 135,30 ); + space->resize ( 133,30 ); space->move ( lalt->x() +lalt->width() +5, sty+ ( 5*35 ) ); connect ( space, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); @@ -341,7 +342,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const other_keys.append(space); ralt = new VButton ( this,"" ); - ralt->resize ( 45,30 ); + ralt->resize ( 48,30 ); ralt->move ( 5+space->x() +space->width(), sty+ ( 5*35 ) ); ralt->setText ( "AltGr" ); ralt->setKeyCode ( 108 ); @@ -350,8 +351,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const ralt->res(); rwin = new VButton ( this,"" ); - rwin->resize ( 50,30 ); - rwin->move ( ralt->x() +ralt->width() +6, sty+ ( 5*35 ) ); + rwin->resize ( 48,30 ); + rwin->move ( ralt->x() +ralt->width() +5, sty+ ( 5*35 ) ); rwin->setText ( "RWin" ); rwin->setKeyCode ( 134 ); rwin->setToggleButton ( true ); @@ -359,8 +360,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const rwin->res(); mnu = new VButton ( this,"" ); - mnu->resize ( 50,30 ); - mnu->move ( rwin->x() +rwin->width() +6, sty+ ( 5*35 ) ); + mnu->resize ( 49,30 ); + mnu->move ( rwin->x() +rwin->width() +5, sty+ ( 5*35 ) ); mnu->setText ( "Menu" ); mnu->setKeyCode ( 135 ); mnu->setToggleButton ( false ); @@ -369,7 +370,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const mnu->res(); rctrl = new VButton ( this,"" ); - rctrl->resize ( 45,30 ); + rctrl->resize ( 49,30 ); rctrl->move ( 5+mnu->x() +mnu->width(), sty+ ( 5*35 ) ); rctrl->setText ( "Ctrl" ); rctrl->setKeyCode ( 105 ); @@ -411,7 +412,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const setFocusPolicy ( TQ_NoFocus ); - int padx= 550; + int padx= 554; TQString txt[9] = { "Ho\nme", TQString::fromUtf8("▲"), "Pg\nUp", TQString::fromUtf8("◄"), " ", TQString::fromUtf8("►"), "End", TQString::fromUtf8("▼"), "Pg\nDn" }; @@ -641,9 +642,9 @@ void MainWidget::restorePosition() TQDesktopWidget *desktop = TQApplication::desktop(); TQRect screen_geom = desktop->screenGeometry(); - int d_width=550; + int d_width=553; int d_height=235; - TQRect dflt_geom(screen_geom.width()-d_width,screen_geom.height()-d_height,d_width,d_height); + TQRect dflt_geom(screen_geom.width()-d_width-150,screen_geom.height()-d_height-50,d_width,d_height); TDEConfig *cfg = 0; cfg = TDEApplication::kApplication()->config(); @@ -688,17 +689,17 @@ void MainWidget::resizeEvent(TQResizeEvent * e) if (extent_visible){ sdxb = width(); - sdxs = width() - (width() * (150.0/700.0)); - VButton::pw=700.0; + sdxs = width() - (width() * (150.0/703.0)); + VButton::pw=703.0; VButton::ph=235.0; - setMinimumSize(700/3,235/3); + setMinimumSize(703/3,235/3); } else{ sdxs = width(); - sdxb = width() + (width() * (150.0/550.0)); - VButton::pw=550.0; + sdxb = width() + (width() * (150.0/552.0)); + VButton::pw=552.0; VButton::ph=235.0; - setMinimumSize(550/3,235/3); + setMinimumSize(552/3,235/3); } for ( unsigned a=0;afont(); fnt.setWeight(TQFont::Bold); //double rs = (100.0/700.0)*width(); - double rp = (8.0/600.0)*width(); + double rp = (11.0/600.0)*width(); + if (extent_visible) + { + rp *= (552.0/703.0); + } //fnt.setStretch(rs); fnt.setPointSizeFloat(rp); setFont(fnt); diff --git a/src/VButton.cpp b/src/VButton.cpp index 9dffe26..b4870f1 100644 --- a/src/VButton.cpp +++ b/src/VButton.cpp @@ -4,7 +4,7 @@ #include #include -double VButton::pw=550.0; +double VButton::pw=552.0; double VButton::ph=235.0; VButton::VButton(TQWidget *parent, const char *name): TQPushButton (parent,name)