|
4 | 4 | global vars, settings |
5 | 5 |
|
6 | 6 | settings.features.cheatsheets := LLK_IniRead("ini\config.ini", "Features", "enable cheat-sheets", 0) |
7 | | - settings.cheatsheets := {} |
8 | | - settings.cheatsheets.fSize := LLK_IniRead("ini\cheat-sheets.ini", "settings", "font-size", settings.general.fSize) |
9 | | - LLK_FontDimensions(settings.cheatsheets.fSize, font_height, font_width) |
10 | | - settings.cheatsheets.fHeight := font_height, settings.cheatsheets.fWidth := font_width |
| 7 | + settings.cheatsheets := {}, ini := IniBatchRead("ini\cheat-sheets.ini") |
| 8 | + settings.cheatsheets.fSize := !Blank(check := ini.settings["font-size"]) ? check : settings.general.fSize |
| 9 | + LLK_FontDimensions(settings.cheatsheets.fSize, font_height, font_width), settings.cheatsheets.fHeight := font_height, settings.cheatsheets.fWidth := font_width |
11 | 10 | settings.cheatsheets.dColors := ["Lime", "Yellow", "Red", "Aqua"] |
12 | | - settings.cheatsheets.colors := [] |
13 | | - settings.cheatsheets.colors[0] := "White" |
14 | | - ;settings.cheatsheets.quick := LLK_IniRead("ini\cheat-sheets.ini", "settings", "quick access", 0) |
| 11 | + settings.cheatsheets.colors := [], settings.cheatsheets.colors[0] := "White" |
15 | 12 | settings.cheatsheets.modifiers := ["alt", "ctrl", "shift"] |
16 | | - settings.cheatsheets.modifier := LLK_IniRead("ini\cheat-sheets.ini", "settings", "modifier-key", "alt") |
| 13 | + settings.cheatsheets.modifier := !Blank(check := ini.settings["modifier-key"]) ? check : "alt" |
17 | 14 | If Blank(LLK_HasVal(settings.cheatsheets.modifiers, settings.cheatsheets.modifier)) ;force alt if modifier-key is an unexpected key |
18 | 15 | settings.cheatsheets.modifier := "alt" |
19 | | - |
20 | 16 | Loop 4 |
21 | | - settings.cheatsheets.colors[A_Index] := LLK_IniRead("ini\cheat-sheets.ini", "UI", "rank " A_Index " color", settings.cheatsheets.dColors[A_Index]) |
22 | | - |
| 17 | + settings.cheatsheets.colors[A_Index] := !Blank(check := ini.UI["rank " A_Index " color"]) ? check : settings.cheatsheets.dColors[A_Index] |
23 | 18 | vars.cheatsheets.count_advanced := 0 ;save number of advanced sheets (used in the settings menu to determine if list of advanced sheets will be shown or not) |
24 | 19 |
|
25 | 20 | ;rebuild list of cheat-sheets |
|
31 | 26 | { |
32 | 27 | If !IsObject(vars.cheatsheets[key]) |
33 | 28 | vars.cheatsheets[key] := {} |
34 | | - vars.cheatsheets.list[key].enable := LLK_IniRead("cheat-sheets\" key "\info.ini", "general", "enable", 1) |
35 | | - vars.cheatsheets.list[key].area := LLK_IniRead("cheat-sheets\" key "\info.ini", "general", "image search", "static") |
36 | | - vars.cheatsheets.list[key].type := LLK_IniRead("cheat-sheets\" key "\info.ini", "general", "type", "images") |
37 | | - vars.cheatsheets.list[key].activation := LLK_IniRead("cheat-sheets\" key "\info.ini", "general", "activation", "hold") |
38 | | - vars.cheatsheets.list[key].scale := LLK_IniRead("cheat-sheets\" key "\info.ini", "UI", "scale", 1) |
39 | | - vars.cheatsheets.list[key].pos := LLK_IniRead("cheat-sheets\" key "\info.ini", "UI", "position", "2,2") |
| 29 | + ini := IniBatchRead("cheat-sheets\" key "\info.ini") |
| 30 | + vars.cheatsheets.list[key].enable := !Blank(check := ini.general.enable) ? check : 1 |
| 31 | + vars.cheatsheets.list[key].area := !Blank(check := ini.general["image search"]) ? check : "static" |
| 32 | + vars.cheatsheets.list[key].type := !Blank(check := ini.general.type) ? check : "images" |
| 33 | + vars.cheatsheets.list[key].activation := !Blank(check := ini.general.activation) ? check : "hold" |
| 34 | + vars.cheatsheets.list[key].scale := !Blank(check := ini.UI.scale) ? check : 1 |
| 35 | + vars.cheatsheets.list[key].pos := !Blank(check := ini.UI.position) ? check : "2,2" |
40 | 36 | vars.cheatsheets.list[key].pos := [SubStr(vars.cheatsheets.list[key].pos, 1, 1), SubStr(vars.cheatsheets.list[key].pos, 3, 1)] |
41 | | - iniread := LLK_IniRead("cheat-sheets\" key "\info.ini", "image search", "last coordinates") |
42 | | - Loop, Parse, iniread, `, |
| 37 | + Loop, Parse, % ini["image search"]["last coordinates"], `, |
43 | 38 | { |
44 | 39 | If (A_Index = 1) |
45 | 40 | vars.cheatsheets.list[key].x1 := A_LoopField |
|
53 | 48 | If (vars.cheatsheets.list[key].type = "advanced") |
54 | 49 | { |
55 | 50 | vars.cheatsheets.count_advanced += 1 |
56 | | - vars.cheatsheets.list[key].variation := LLK_IniRead("cheat-sheets\" key "\info.ini", "general", "image search variation", 0) ;each sheet has its own imgsearch-variation (strictness) which is determined on-the-fly, then saved for future use |
57 | | - iniread := LLK_IniRead("cheat-sheets\" key "\info.ini", "entries") ;load a sheet's entries from ini |
| 51 | + vars.cheatsheets.list[key].variation := !Blank(check := ini.general["image search variation"]) ? check : 0 ;each sheet has its own imgsearch-variation (strictness) which is determined on-the-fly, then saved for future use |
58 | 52 | vars.cheatsheets.list[key].entries := {} ;store the entries here |
59 | | - Loop, Parse, iniread, `n |
| 53 | + For kEntry, vEntry in ini.entries |
60 | 54 | { |
61 | | - parse1 := SubStr(A_LoopField, 1, InStr(A_LoopField, "=") - 1) |
62 | | - vars.cheatsheets.list[key].entries[parse1] := {"panels": [], "ranks": []} ;each entry has panels which may also be ranked |
| 55 | + vars.cheatsheets.list[key].entries[kEntry] := {"panels": [], "ranks": []} ;each entry has panels which may also be ranked |
63 | 56 | Loop 4 |
64 | 57 | { |
65 | | - vars.cheatsheets.list[key].entries[parse1].panels[A_Index] := StrReplace(LLK_IniRead("cheat-sheets\" key "\info.ini", parse1, "panel "A_Index), "^^^", "`n") |
66 | | - vars.cheatsheets.list[key].entries[parse1].ranks[A_Index] := LLK_IniRead("cheat-sheets\" key "\info.ini", parse1, "panel " A_Index " rank", 0) |
| 58 | + vars.cheatsheets.list[key].entries[kEntry].panels[A_Index] := StrReplace(ini[kEntry]["panel " A_Index], "^^^", "`n") |
| 59 | + vars.cheatsheets.list[key].entries[kEntry].ranks[A_Index] := !Blank(check := ini[kEntry]["panel " A_Index " rank"]) ? check : 0 |
67 | 60 | } |
68 | 61 | } |
69 | 62 | } |
70 | 63 | Else If (vars.cheatsheets.list[key].type = "app") |
71 | | - vars.cheatsheets.list[key].title := LLK_IniRead("cheat-sheets\" key "\info.ini", "general", "app title") |
| 64 | + vars.cheatsheets.list[key].title := ini.general["app title"] |
72 | 65 | Else If (vars.cheatsheets.list[key].type = "images") |
73 | | - vars.cheatsheets.list[key].header := LLK_IniRead("cheat-sheets\"key "\info.ini", "general", "00-position", "top") |
| 66 | + vars.cheatsheets.list[key].header := !Blank(check := ini.general["00-position"]) ? check : "top" |
74 | 67 | } |
75 | 68 | } |
76 | 69 |
|
@@ -579,6 +572,7 @@ CheatsheetImage(name := "", hotkey := "") ;'hotkey' parameter used when overlay |
579 | 572 | Return |
580 | 573 | } |
581 | 574 | Gdip_GetImageDimensions(pBitmap, width, height) |
| 575 | + |
582 | 576 | If (height >= vars.monitor.h*0.9) |
583 | 577 | { |
584 | 578 | pBitmap_copy := pBitmap |
@@ -684,7 +678,7 @@ CheatsheetInfo(name) |
684 | 678 | Gui, cheatsheet_info: Add, Text, % "Section xs BackgroundTrans w"settings.general.fWidth*35, % "instructions:" |
685 | 679 | Gui, cheatsheet_info: Font, norm |
686 | 680 | IniRead, ini, % "cheat-sheets\" name "\info.ini", general, instructions, % "to recalibrate, screen-cap the area displayed above" |
687 | | - While (ini != "") |
| 681 | + While (ini != "" && ini != " ") |
688 | 682 | { |
689 | 683 | Gui, cheatsheet_info: Add, Text, % "xs y+0 BackgroundTrans w"settings.general.fWidth*35, % "–> " ini |
690 | 684 | IniRead, ini, % "cheat-sheets\" name "\info.ini", general, instructions%A_Index%, % A_Space |
@@ -866,6 +860,7 @@ CheatsheetMenu2(cHWND) ;function to handle inputs within the 'cheatsheet_menu' G |
866 | 860 | LLK_Drag(w, h, xPos, yPos, 1, A_Gui) |
867 | 861 | Sleep 1 |
868 | 862 | } |
| 863 | + vars.general.drag := 0 |
869 | 864 | } |
870 | 865 | Else LLK_Tooltip("no action") |
871 | 866 |
|
@@ -1162,11 +1157,11 @@ CheatsheetMenuEntrySave() |
1162 | 1157 | local |
1163 | 1158 | global vars, settings |
1164 | 1159 |
|
1165 | | - name := vars.cheatsheet_menu.active |
| 1160 | + name := vars.cheatsheet_menu.active, ini := IniBatchRead("cheat-sheets\" name "\info.ini") |
1166 | 1161 | Loop 4 |
1167 | 1162 | { |
1168 | 1163 | vars.cheatsheets.list[name].entries[vars.cheatsheet_menu.entry].panels[A_Index] := LLK_ControlGet(vars.hwnd.cheatsheet_menu["panelentry_"A_Index]) |
1169 | | - If (StrReplace(LLK_ControlGet(vars.hwnd.cheatsheet_menu["panelentry_"A_Index]), "`n", "^^^") != LLK_IniRead("cheat-sheets\"name "\info.ini", vars.cheatsheet_menu.entry, "panel "A_Index)) |
| 1164 | + If (StrReplace(LLK_ControlGet(vars.hwnd.cheatsheet_menu["panelentry_"A_Index]), "`n", "^^^") != ini[vars.cheatsheet_menu.entry]["panel " A_Index]) |
1170 | 1165 | IniWrite, % """" StrReplace(LLK_ControlGet(vars.hwnd.cheatsheet_menu["panelentry_"A_Index]), "`n", "^^^") """", % "cheat-sheets\"name "\info.ini", % vars.cheatsheet_menu.entry, % "panel " A_Index |
1171 | 1166 | } |
1172 | 1167 | } |
|
0 commit comments