mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-05 22:50:23 +00:00
Added Option for swapping left/right mouse buttons in the IDE
This commit is contained in:
parent
d78ad76d3a
commit
36d3bb4a47
|
@ -4,20 +4,21 @@ DIM SHARED IDEBackgroundColor AS _UNSIGNED LONG
|
|||
DIM SHARED IDE_AutoPosition AS _BYTE, IDE_TopPosition AS INTEGER, IDE_LeftPosition AS INTEGER
|
||||
DIM SHARED IDE_Index$
|
||||
DIM SHARED LoadedIDESettings AS INTEGER
|
||||
DIM SHARED MouseButtonSwapped AS _BYTE
|
||||
|
||||
IF LoadedIDESettings = 0 THEN
|
||||
'We only want to load the file once when QB64 first starts
|
||||
'Other changes should occur to our settings when we change them in their appropiate routines.
|
||||
'There's no reason to open and close and open and close the same file a million times.
|
||||
'We only want to load the file once when QB64 first starts
|
||||
'Other changes should occur to our settings when we change them in their appropiate routines.
|
||||
'There's no reason to open and close and open and close the same file a million times.
|
||||
|
||||
LoadedIDESettings = -1
|
||||
LoadedIDESettings = -1
|
||||
|
||||
ConfigFile$ = "internal/config.txt"
|
||||
ConfigBak$ = "internal/config.bak"
|
||||
ConfigFile$ = "internal/config.txt"
|
||||
ConfigBak$ = "internal/config.bak"
|
||||
|
||||
GOSUB CheckConfigFileExists 'make certain the config file exists and if not, create one
|
||||
GOSUB CheckConfigFileExists 'make certain the config file exists and if not, create one
|
||||
|
||||
IF INSTR(_OS$, "WIN") THEN
|
||||
IF INSTR(_OS$, "WIN") THEN
|
||||
|
||||
result = ReadConfigSetting("AllowIndependentSettings", value$)
|
||||
IF result THEN
|
||||
|
@ -84,6 +85,16 @@ IF INSTR(_OS$, "WIN") THEN
|
|||
WriteConfigSetting "'[IDE COLOR SETTINGS]", "BackgroundColor", "_RGB32(0,0,170)"
|
||||
END IF
|
||||
|
||||
result = ReadConfigSetting("SwapMouseButton", value$)
|
||||
if value$ = "TRUE" or val(value$) = -1 then
|
||||
MouseButtonSwapped = -1
|
||||
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "TRUE"
|
||||
else
|
||||
MouseButtonSwapped = 0
|
||||
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE"
|
||||
end if
|
||||
|
||||
|
||||
|
||||
IF INSTR(_OS$, "WIN") THEN
|
||||
|
||||
|
@ -132,6 +143,8 @@ IF INSTR(_OS$, "WIN") THEN
|
|||
IDE_TopPosition = 0
|
||||
IDE_LeftPosition = 0
|
||||
END IF
|
||||
|
||||
|
||||
result = ReadConfigSetting("IDE_Width", value$)
|
||||
idewx = VAL(value$)
|
||||
IF idewx < 80 OR idewx > 1000 THEN idewx = 80: WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Width", "80"
|
||||
|
@ -225,6 +238,7 @@ IF INSTR(_OS$, "WIN") THEN
|
|||
result = ReadConfigSetting("IDE_AndroidMakeScript$", value$)
|
||||
IdeAndroidMakeScript$ = value$ 'no default values in case this fails??
|
||||
IF result = 0 THEN WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMakeScript$", "programs\android\start_android.bat"
|
||||
IF result = 0 THEN WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMakeScript$", "programs\android\start_android.bat"
|
||||
|
||||
|
||||
GOTO SkipCheckConfigFileExists
|
||||
|
@ -258,6 +272,7 @@ IF INSTR(_OS$, "WIN") THEN
|
|||
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont$", "c:\windows\fonts\lucon.ttf"
|
||||
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE"
|
||||
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CodePage", "0"
|
||||
WriteConfigSetting "'[MOUSE SETTINGS]", "Mouse_Orentation$", "RIGHT"
|
||||
ELSE
|
||||
'use the main config file as the default values and just copy it over to the new file
|
||||
f = FREEFILE
|
||||
|
|
|
@ -239,6 +239,7 @@ IF idelaunched = 0 THEN
|
|||
menu$(m, i) = "#Backup/Undo...": i = i + 1
|
||||
menu$(m, i) = "-": i = i + 1
|
||||
menu$(m, i) = "#Advanced...": i = i + 1
|
||||
menu$(m, i) = "#Swap Mouse Buttons": i = i + 1
|
||||
menu$(m, i) = "-": i = i + 1
|
||||
menu$(m, i) = "#Google Android...": i = i + 1
|
||||
|
||||
|
@ -3148,6 +3149,20 @@ DO
|
|||
GOTO ideloop
|
||||
END IF
|
||||
|
||||
|
||||
IF menu$(m, s) = "#Swap Mouse Buttons" THEN
|
||||
PCOPY 2, 0
|
||||
MouseButtonSwapped = NOT MouseButtonSwapped
|
||||
if MouseButtonSwapped then
|
||||
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "TRUE"
|
||||
else
|
||||
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE"
|
||||
end if
|
||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||
GOTO ideloop
|
||||
END IF
|
||||
|
||||
|
||||
IF menu$(m, s) = "#Code layout..." THEN
|
||||
PCOPY 2, 0
|
||||
retval = idelayoutbox
|
||||
|
@ -8898,7 +8913,11 @@ IF k THEN
|
|||
END IF
|
||||
DO WHILE _MOUSEINPUT
|
||||
iCHANGED = 1
|
||||
if MouseButtonSwapped then
|
||||
mB = _MOUSEBUTTON(2): mB2 = _MOUSEBUTTON(1)
|
||||
else
|
||||
mB = _MOUSEBUTTON(1): mB2 = _MOUSEBUTTON(2)
|
||||
end if
|
||||
mWHEEL = mWHEEL + _MOUSEWHEEL
|
||||
mX = _MOUSEX: mY = _MOUSEY
|
||||
IF mB <> 0 AND mOB = 0 THEN mCLICK = -1: EXIT SUB
|
||||
|
@ -9507,6 +9526,12 @@ DO
|
|||
LINE (x * 40 - 40, y * 30 - 30)-(x * 40, y * 30), _RGBA32(255, 255, 255, 150), BF
|
||||
|
||||
k1 = _KEYHIT
|
||||
MouseClick = 0: MouseExit = 0
|
||||
if MouseButtonSwapped then
|
||||
mouseclick = _mousebutton(2): mouseexit = _mousebutton(1)
|
||||
else
|
||||
mouseclick = _mousebutton(1): mouseexit = _mousebutton(2)
|
||||
end if
|
||||
SELECT CASE k1
|
||||
CASE 13: EXIT DO
|
||||
CASE 27
|
||||
|
@ -9533,7 +9558,14 @@ DO
|
|||
IF _RESIZE THEN donothing = atall
|
||||
EXIT FUNCTION
|
||||
END IF
|
||||
LOOP UNTIL _MOUSEBUTTON(1)
|
||||
IF MouseExit THEN
|
||||
_AUTODISPLAY
|
||||
SCREEN 0: WIDTH w, h: _DEST 0: _DELAY .2
|
||||
IF _RESIZE THEN donothing = atall
|
||||
EXIT FUNCTION
|
||||
END IF
|
||||
|
||||
LOOP UNTIL mouseclick
|
||||
|
||||
ret% = (y - 1) * 16 + x - 1
|
||||
IF ret% > 0 AND ret% < 255 THEN
|
||||
|
|
Loading…
Reference in a new issue