summaryrefslogtreecommitdiffstats
path: root/windows/neo-vars/src/source/screenkeyboard_new.ahk
blob: 8e61abcb8d8192af7c7d5056223fd48e62896467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
BSTNguiErstellt := 0
BSTNalwaysOnTop := 1

CP3F2 := "P_BSTNt"

UnZipLocalFile := ApplicationFolder . "\unzip.exe"
UnZipSourceLink := "http://stahlworks.com/dev/unzip.exe"

UniFontVersion  := "2.30"
UniFontFilename := "DejaVuSans.ttf"
UniFontName     := "DejaVu Sans"

UniFontZipFilename   := "dejavu-fonts-ttf-" . UniFontVersion . ".zip"
UniFontZipLocalFile  := ApplicationFolder . "\" . UniFontZipFilename

UniFontZipSourceLink := "http://downloads.sourceforge.net/project/dejavu/dejavu/" . UniFontVersion . "/" . UniFontZipFilename

UniFontLocalFile := ApplicationFolder . "/" . UniFontFilename
UniFontZipFontPath := "dejavu-fonts-ttf-" . UniFontVersion . "/ttf/" . UniFontFilename

BSTNUpdate() {
    global
    static WM_SETTEXT := 0x0C
    {
      VarSetCapacity(ptrU,20)
      loop,parse,GuiKeyList,`,
      {
        sc := A_LoopField
        GuiPhysKey := vksc%sc%
        if (EbeneC<3) {
          if (NOC%GuiPhysKey%==1) {
            GuiEb := EbeneNC
          } else {
	    GuiEb := EbeneC
          }
        } else
          GuiEb := EbeneC
        GuiComp := Comp . CP%GuiEb%%GuiPhysKey%
        if (CD%GuiComp% != "") {
          GuiComp := CD%GuiComp%
        } else if (CM%GuiComp% == 1) {
          GuiComp := "U00002A"
        } else if (Comp != "") {
          GuiComp := ""
        }
	GuiPos := 0
        loop {
          if (GuiComp=="")
            break
	  if (SubStr(GuiComp,1,1)=="U") {
            Charcode := "0x" . Substr(GuiComp,2,6)
	      if (charCode < 0x10000) {
	        NumPut(CharCode, ptrU, GuiPos, "UShort")
              } else {
                ; surrogates
                NumPut(0xD800|((charCode-0x10000)/1024) , ptrU, GuiPos, "UShort")
		GuiPos := GuiPos + 2
                NumPut(0xDC00|((charCode-0x10000)&0x3FF), ptrU, GuiPos, "UShort")
              }
            GuiPos := GuiPos + 2
	  }
          GuiComp := SubStr(GuiComp,8)
        }
        NumPut(0x0   ,ptrU,GuiPos,"UShort") ; End of string	
        DllCall("SendMessageW", "UInt",GuiKey%sc%, "UInt",WM_SETTEXT, "UInt",0, "Uint",&ptrU)
      }
    }
}

GuiAddKey(sc,x,y) {
  global
  Gui, Add, Text, x%x% y%y% Center hwndGuiKey%sc%, MM
  GuiKeyList := GuiKeyList . sc . ","
}

BSTNToggle() {
  global
  if (BSTNguiErstellt) {
    BSTNguiErstellt := 0
    Gui, Destroy
  } else {
    if (FileExist(ResourceFolder)!="") {
      FileInstall,ebene0.png,%ResourceFolder%\ebene0.png,1
    }

    if (FileExist(UniFontLocalFile)=="") {
      if (FileExist(UnZipLocalFile)=="") {
        Progress,0,,Herunterladen des Entpack-Programms ...
        UrlDownloadToFile,%UnZipSourceLink%,%UnZipLocalFile%
        if (FileExist(UnZipLocalFile)=="") {
          Msgbox,Konnte Unzip-Programm nicht finden und nicht installieren!
        }
      }

      if (FileExist(UniFontZipLocalFile)=="") {
        Progress,20,Herunterladen des Fonts ...
        UrlDownloadToFile,%UniFontZipSourceLink%,%UniFontZipLocalFile%
      }

      Progress,80,Entpacken des Archivs ...
      RunWait,% """" . UnZipLocalFile . """ -j """ . UniFontZipLocalFile . """ """ . UniFontZipFontPath . """",%ApplicationFolder%,Hide
      Progress,OFF
    }

    DllCall( "GDI32.DLL\AddFontResourceEx", Str, UniFontLocalFile ,UInt,(FR_PRIVATE:=0x10), Int,0)


    SysGet, WorkArea, MonitorWorkArea
    yPosition := WorkAreaBottom - 230
    Gui, Color, FFFFFF
    Gui, Add, Picture,AltSubmit x0   y0          vPicture0, % ResourceFolder . "\ebene0.png"
    Gui, Font, s10 bold, %UniFontName%
    GuiKeyList := ""
    GuiAddKey("029",12,8)
    GuiAddKey("002",52,8)
    GuiAddKey("003",90,8)
    GuiAddKey("004",128,8)
    GuiAddKey("005",166,8)
    GuiAddKey("006",204,8)
    GuiAddKey("007",242,8)
    GuiAddKey("008",280,8)
    GuiAddKey("009",318,8)
    GuiAddKey("00A",356,8)
    GuiAddKey("00B",394,8)
    GuiAddKey("00C",432,8)
    GuiAddKey("00D",470,8)

    GuiAddKey("010",64,48)
    GuiAddKey("011",102,48)
    GuiAddKey("012",140,48)
    GuiAddKey("013",178,48)
    GuiAddKey("014",216,48)
    GuiAddKey("015",254,48)
    GuiAddKey("016",292,48)
    GuiAddKey("017",330,48)
    GuiAddKey("018",368,48)
    GuiAddKey("019",406,48)
    GuiAddKey("01A",444,48)
    GuiAddKey("01B",484,48)
    GuiAddKey("00D",532,48)

    GuiAddKey("01E",82,88)
    GuiAddKey("01F",120,88)
    GuiAddKey("020",158,88)
    GuiAddKey("021",196,88)
    GuiAddKey("022",234,88)
    GuiAddKey("023",272,88)
    GuiAddKey("024",310,88)
    GuiAddKey("025",348,88)
    GuiAddKey("026",386,88)
    GuiAddKey("027",424,88)
    GuiAddKey("028",462,88)

    GuiAddKey("02C",94,128)
    GuiAddKey("02D",132,128)
    GuiAddKey("02E",170,128)
    GuiAddKey("02F",208,128)
    GuiAddKey("030",246,128)
    GuiAddKey("031",284,128)
    GuiAddKey("032",322,128)
    GuiAddKey("033",360,128)
    GuiAddKey("034",398,128)
    GuiAddKey("035",436,128)
    Gui, +AlwaysOnTop +ToolWindow
    Gui, Show, y%yposition% w776 h200 NoActivate, NEO-Bildschirmtastatur (neu!)
    BSTNguiErstellt := 1
    BSTNUpdate()
    BSTNalwaysOnTop := 1
  }
}

BSTNToggleAlwaysOnTop() {
  global
  if (BSTNalwaysOnTop) {
    Gui, -AlwaysOnTop
    BSTNalwaysOnTop := 0    
  } else {
    Gui, +AlwaysOnTop
    BSTNalwaysOnTop := 1
  }
}

CharProc_BSTNt() {
  global
  ; Bildschirmtastatur Ein/Aus
  BSTNToggle()
}

CharProc_BSTNA() {
  global
  ; Bildschirmtastatur AlwaysOnTop
  if (BSTNguiErstellt)
    BSTNToggleAlwaysOnTop()
}