mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-06-30 05:10:37 +00:00
Add "Cursor after pasted content" to Options menu.
Default behavior (which mimics Qbasic) is to keep the cursor in place even after pasting from the clipboard. This new option alters such behavior to act as modern systems, placing the cursor after the pasted content. Also: - Add visual indication that mouse buttons have been swapped (Options menu); - Allows opening menus with a right-click (in case you forget you swapped mouse buttons); - Minor tweaks to Code layout dialog box.
This commit is contained in:
parent
2941473ea2
commit
218536343a
|
@ -6,6 +6,7 @@ DIM SHARED IDE_AutoPosition AS _BYTE, IDE_TopPosition AS INTEGER, IDE_LeftPositi
|
||||||
DIM SHARED IDE_Index$
|
DIM SHARED IDE_Index$
|
||||||
DIM SHARED LoadedIDESettings AS INTEGER
|
DIM SHARED LoadedIDESettings AS INTEGER
|
||||||
DIM SHARED MouseButtonSwapped AS _BYTE
|
DIM SHARED MouseButtonSwapped AS _BYTE
|
||||||
|
DIM SHARED PasteCursorAtEnd AS _BYTE
|
||||||
|
|
||||||
IF LoadedIDESettings = 0 THEN
|
IF LoadedIDESettings = 0 THEN
|
||||||
'We only want to load the file once when QB64 first starts
|
'We only want to load the file once when QB64 first starts
|
||||||
|
@ -103,7 +104,18 @@ IF LoadedIDESettings = 0 THEN
|
||||||
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE"
|
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE"
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
result = ReadConfigSetting("PasteCursorAtEnd", value$)
|
||||||
|
IF result THEN
|
||||||
|
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||||
|
PasteCursorAtEnd = -1
|
||||||
|
ELSE
|
||||||
|
PasteCursorAtEnd = 0
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "PasteCursorAtEnd", "FALSE"
|
||||||
|
END IF
|
||||||
|
ELSE
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "PasteCursorAtEnd", "FALSE"
|
||||||
|
PasteCursorAtEnd = 0
|
||||||
|
END IF
|
||||||
|
|
||||||
IF INSTR(_OS$, "WIN") THEN
|
IF INSTR(_OS$, "WIN") THEN
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@ DIM SHARED BuildNum AS STRING
|
||||||
Version$ = "1.000"
|
Version$ = "1.000"
|
||||||
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
|
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
|
||||||
'integer. If you make a change, update the date and increase the id!
|
'integer. If you make a change, update the date and increase the id!
|
||||||
BuildNum$ = "20160428/13"
|
BuildNum$ = "20160507/14"
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,7 @@ DIM SHARED menu$(1 TO 10, 0 TO 20)
|
||||||
DIM SHARED menusize(1 TO 10)
|
DIM SHARED menusize(1 TO 10)
|
||||||
DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER
|
DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER
|
||||||
DIM SHARED ideeditmenuID AS INTEGER
|
DIM SHARED ideeditmenuID AS INTEGER
|
||||||
|
DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER
|
||||||
DIM SHARED menubar$, idecontextualSearch$
|
DIM SHARED menubar$, idecontextualSearch$
|
||||||
DIM SHARED ideundocombo, ideundocombochr, idenoundo, idemergeundo
|
DIM SHARED ideundocombo, ideundocombochr, idenoundo, idemergeundo
|
||||||
DIM SHARED idealthighlight, ideentermenu
|
DIM SHARED idealthighlight, ideentermenu
|
||||||
|
|
|
@ -248,7 +248,7 @@ IF idelaunched = 0 THEN
|
||||||
IF IdeAndroidMenu THEN menusize(m) = i - 1
|
IF IdeAndroidMenu THEN menusize(m) = i - 1
|
||||||
|
|
||||||
|
|
||||||
m = m + 1: i = 0
|
m = m + 1: i = 0: OptionsMenuID = m
|
||||||
menu$(m, i) = "Options": i = i + 1
|
menu$(m, i) = "Options": i = i + 1
|
||||||
menu$(m, i) = "#Display...": i = i + 1
|
menu$(m, i) = "#Display...": i = i + 1
|
||||||
menu$(m, i) = "C#olors...": i = i + 1
|
menu$(m, i) = "C#olors...": i = i + 1
|
||||||
|
@ -257,7 +257,19 @@ IF idelaunched = 0 THEN
|
||||||
menu$(m, i) = "#Backup/Undo...": i = i + 1
|
menu$(m, i) = "#Backup/Undo...": i = i + 1
|
||||||
menu$(m, i) = "-": i = i + 1
|
menu$(m, i) = "-": i = i + 1
|
||||||
menu$(m, i) = "#Advanced...": i = i + 1
|
menu$(m, i) = "#Advanced...": i = i + 1
|
||||||
menu$(m, i) = "#Swap Mouse Buttons": i = i + 1
|
|
||||||
|
OptionsMenuSwapMouse = i
|
||||||
|
menu$(m, i) = menu$(m, i) + "#Swap Mouse Buttons": i = i + 1
|
||||||
|
IF MouseButtonSwapped THEN
|
||||||
|
menu$(OptionsMenuID, OptionsMenuSwapMouse) = CHR$(7) + menu$(OptionsMenuID, OptionsMenuSwapMouse)
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
OptionsMenuPasteCursor = i
|
||||||
|
menu$(m, i) = menu$(m, i) + "Cursor after #pasted content": i = i + 1
|
||||||
|
IF PasteCursorAtEnd THEN
|
||||||
|
menu$(OptionsMenuID, OptionsMenuPasteCursor) = CHR$(7) + menu$(OptionsMenuID, OptionsMenuPasteCursor)
|
||||||
|
ENDIF
|
||||||
|
|
||||||
menu$(m, i) = "-": i = i + 1
|
menu$(m, i) = "-": i = i + 1
|
||||||
menu$(m, i) = "#Google Android...": i = i + 1
|
menu$(m, i) = "#Google Android...": i = i + 1
|
||||||
|
|
||||||
|
@ -1309,7 +1321,7 @@ DO
|
||||||
LOCATE , , 0
|
LOCATE , , 0
|
||||||
LOCATE , , , 8, 8
|
LOCATE , , , 8, 8
|
||||||
|
|
||||||
IF mCLICK AND idemouseselect = 0 THEN
|
IF (mCLICK OR mCLICK2) AND idemouseselect = 0 THEN
|
||||||
IF mY = 1 THEN
|
IF mY = 1 THEN
|
||||||
x = 3
|
x = 3
|
||||||
FOR i = 1 TO menus
|
FOR i = 1 TO menus
|
||||||
|
@ -2741,6 +2753,11 @@ DO
|
||||||
|
|
||||||
IF x3 <= LEN(a$) GOTO fullpastenextline
|
IF x3 <= LEN(a$) GOTO fullpastenextline
|
||||||
|
|
||||||
|
IF PasteCursorAtEnd THEN
|
||||||
|
'Place the cursor at the end of the pasted content:
|
||||||
|
idecy = idecy + i - 1
|
||||||
|
idecx = LEN(idegetline(idecy)) + 1
|
||||||
|
END IF
|
||||||
ELSE
|
ELSE
|
||||||
|
|
||||||
'insert single line paste
|
'insert single line paste
|
||||||
|
@ -2749,6 +2766,10 @@ DO
|
||||||
a$ = LEFT$(a$, idecx - 1) + clip$ + RIGHT$(a$, LEN(a$) - idecx + 1)
|
a$ = LEFT$(a$, idecx - 1) + clip$ + RIGHT$(a$, LEN(a$) - idecx + 1)
|
||||||
idesetline idecy, converttabs$(a$)
|
idesetline idecy, converttabs$(a$)
|
||||||
|
|
||||||
|
IF PasteCursorAtEnd THEN
|
||||||
|
'Place the cursor at the end of the pasted content:
|
||||||
|
idecx = idecx + len(clip$)
|
||||||
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
idechangemade = 1
|
idechangemade = 1
|
||||||
|
@ -3306,7 +3327,7 @@ DO
|
||||||
KB = KEY_ESC
|
KB = KEY_ESC
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF mCLICK THEN
|
IF mCLICK OR mCLICK2 THEN
|
||||||
IF mY = 1 THEN
|
IF mY = 1 THEN
|
||||||
FOR i = 1 to menus
|
FOR i = 1 to menus
|
||||||
x = CVI(MID$(MenuLocations, i * 2 - 1, 2))
|
x = CVI(MID$(MenuLocations, i * 2 - 1, 2))
|
||||||
|
@ -3389,6 +3410,7 @@ DO
|
||||||
l = LEN(m$)
|
l = LEN(m$)
|
||||||
IF INSTR(m$, "#") THEN l = l - 1
|
IF INSTR(m$, "#") THEN l = l - 1
|
||||||
IF LEFT$(m$, 1) = "~" THEN l = l - 1
|
IF LEFT$(m$, 1) = "~" THEN l = l - 1
|
||||||
|
IF LEFT$(m$, 1) = CHR$(7) THEN l = l - 1
|
||||||
IF INSTR(m$, " ") THEN l = l + 2 'min 4 spacing
|
IF INSTR(m$, " ") THEN l = l + 2 'min 4 spacing
|
||||||
IF l > w THEN w = l
|
IF l > w THEN w = l
|
||||||
NEXT
|
NEXT
|
||||||
|
@ -3424,7 +3446,7 @@ DO
|
||||||
NEXT
|
NEXT
|
||||||
ELSE
|
ELSE
|
||||||
IF r = i THEN LOCATE i + yy, xx - 1: COLOR 7, 0: PRINT SPACE$(w + 2);
|
IF r = i THEN LOCATE i + yy, xx - 1: COLOR 7, 0: PRINT SPACE$(w + 2);
|
||||||
LOCATE i + yy, xx
|
IF LEFT$(m$, 1) = CHR$(7) THEN LOCATE i + yy, xx - 1 ELSE LOCATE i + yy, xx
|
||||||
h = -1: x = INSTR(m$, "#"): IF x THEN h = x: m$ = LEFT$(m$, x - 1) + RIGHT$(m$, LEN(m$) - x)
|
h = -1: x = INSTR(m$, "#"): IF x THEN h = x: m$ = LEFT$(m$, x - 1) + RIGHT$(m$, LEN(m$) - x)
|
||||||
x = INSTR(m$, " "): IF x THEN m1$ = LEFT$(m$, x - 1): m2$ = RIGHT$(m$, LEN(m$) - x - 1): m$ = m1$ + SPACE$(w - LEN(m1$) - LEN(m2$)) + m2$
|
x = INSTR(m$, " "): IF x THEN m1$ = LEFT$(m$, x - 1): m2$ = RIGHT$(m$, LEN(m$) - x - 1): m$ = m1$ + SPACE$(w - LEN(m1$) - LEN(m2$)) + m2$
|
||||||
FOR x = 1 TO LEN(m$)
|
FOR x = 1 TO LEN(m$)
|
||||||
|
@ -3731,18 +3753,33 @@ DO
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
|
||||||
IF menu$(m, s) = "#Swap Mouse Buttons" THEN
|
IF RIGHT$(menu$(m, s), 19) = "#Swap Mouse Buttons" THEN
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
MouseButtonSwapped = NOT MouseButtonSwapped
|
MouseButtonSwapped = NOT MouseButtonSwapped
|
||||||
if MouseButtonSwapped then
|
if MouseButtonSwapped then
|
||||||
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "TRUE"
|
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "TRUE"
|
||||||
|
menu$(OptionsMenuID, OptionsMenuSwapMouse) = CHR$(7) + "#Swap Mouse Buttons"
|
||||||
else
|
else
|
||||||
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE"
|
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE"
|
||||||
|
menu$(OptionsMenuID, OptionsMenuSwapMouse) = "#Swap Mouse Buttons"
|
||||||
end if
|
end if
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
IF RIGHT$(menu$(m, s), 28) = "Cursor after #pasted content" THEN
|
||||||
|
PCOPY 2, 0
|
||||||
|
PasteCursorAtEnd = NOT PasteCursorAtEnd
|
||||||
|
if PasteCursorAtEnd then
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "PasteCursorAtEnd", "TRUE"
|
||||||
|
menu$(OptionsMenuID, OptionsMenuPasteCursor) = CHR$(7) + "Cursor after #pasted content"
|
||||||
|
else
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "PasteCursorAtEnd", "FALSE"
|
||||||
|
menu$(OptionsMenuID, OptionsMenuPasteCursor) = "Cursor after #pasted content"
|
||||||
|
end if
|
||||||
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
|
GOTO ideloop
|
||||||
|
END IF
|
||||||
|
|
||||||
IF menu$(m, s) = "#Code layout..." THEN
|
IF menu$(m, s) = "#Code layout..." THEN
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
|
@ -8814,7 +8851,7 @@ sep = CHR$(0)
|
||||||
|
|
||||||
'-------- init --------
|
'-------- init --------
|
||||||
i = 0
|
i = 0
|
||||||
idepar p, 60, 7, "Code Layout"
|
idepar p, 60, 8, "Code Layout"
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
o(i).typ = 4 'check box
|
o(i).typ = 4 'check box
|
||||||
|
@ -8845,7 +8882,7 @@ o(i).sel = ideindentsubs
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
o(i).typ = 3
|
o(i).typ = 3
|
||||||
o(i).y = 7
|
o(i).y = 8
|
||||||
o(i).txt = idenewtxt("OK" + sep + "#Cancel")
|
o(i).txt = idenewtxt("OK" + sep + "#Cancel")
|
||||||
o(i).dft = 1
|
o(i).dft = 1
|
||||||
'-------- end of init --------
|
'-------- end of init --------
|
||||||
|
|
Loading…
Reference in a new issue