1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-02 23:31:21 +00:00

Saves color schemes individually for each instance of the IDE.

This commit is contained in:
FellippeHeitor 2021-09-10 21:26:04 -03:00
parent 59dd67c74d
commit 86984024bf
2 changed files with 59 additions and 59 deletions

View file

@ -20,8 +20,12 @@ DIM SHARED mouseSettingsSection$, generalSettingsSection$, displaySettingsSectio
DIM SHARED colorSchemesSection$, debugSettingsSection$, iniFolderIndex$, DebugInfoIniWarning$, ConfigFile$
DIM SHARED idebaseTcpPort AS LONG
windowSettingsSection$ = "IDE WINDOW"
colorSettingsSection$ = "IDE COLOR SETTINGS"
ConfigFile$ = "internal/config.ini"
iniFolderIndex$ = STR$(tempfolderindex)
DebugInfoIniWarning$ = " 'Do not change manually. Use 'qb64 -s', or Options->Advanced in the IDE"
windowSettingsSection$ = "IDE WINDOW" + iniFolderIndex$
colorSettingsSection$ = "IDE COLOR SETTINGS" + iniFolderIndex$
colorSchemesSection$ = "IDE COLOR SCHEMES"
customDictionarySection$ = "CUSTOM DICTIONARIES"
mouseSettingsSection$ = "MOUSE SETTINGS"
@ -29,10 +33,6 @@ generalSettingsSection$ = "GENERAL SETTINGS"
displaySettingsSection$ = "IDE DISPLAY SETTINGS"
debugSettingsSection$ = "DEBUG SETTINGS"
ConfigFile$ = "internal/config.ini"
iniFolderIndex$ = STR$(tempfolderindex)
DebugInfoIniWarning$ = " 'Do not change manually. Use 'qb64 -s', or Options->Advanced in the IDE"
IniSetAddQuotes 0
IniSetForceReload -1
IniSetAllowBasicComments -1
@ -382,13 +382,58 @@ result = ReadConfigSetting(displaySettingsSection$, "IDE_CodePage", value$)
idecpindex = VAL(value$)
IF idecpindex < 0 OR idecpindex > idecpnum THEN idecpindex = 0: WriteConfigSetting displaySettingsSection$, "IDE_CodePage", "0"
'Color settings ---------------------------------------------------------------
'Schemes:
'Custom keywords --------------------------------------------------------------
IF ReadConfigSetting(customDictionarySection$, "CustomKeywords$", value$) THEN
tempList$ = ""
listOfCustomKeywords$ = "@" + UCASE$(value$) + "@"
FOR I = 1 TO LEN(listOfCustomKeywords$)
checkChar = ASC(listOfCustomKeywords$, I)
IF checkChar = 64 THEN
IF RIGHT$(tempList$, 1) <> "@" THEN tempList$ = tempList$ + "@"
ELSE
tempList$ = tempList$ + CHR$(checkChar)
END IF
NEXT
listOfCustomKeywords$ = tempList$
customKeywordsLength = LEN(listOfCustomKeywords$)
ELSE
IniSetAddQuotes -1
WriteConfigSetting customDictionarySection$, "Instructions1", "Add custom keywords separated by the 'at' sign."
WriteConfigSetting customDictionarySection$, "Instructions2", "Useful to colorize constants (eg @true@false@)."
IniSetAddQuotes 0
WriteConfigSetting customDictionarySection$, "CustomKeywords$", "@"
END IF
'Color schemes ---------------------------------------------------------------
IniSetAddQuotes -1
WriteConfigSetting colorSchemesSection$, "Instructions1", "Create custom color schemes in the IDE (Options->IDE Colors)."
WriteConfigSetting colorSchemesSection$, "Instructions2", "Custom color schemes will be stored in this section."
IniSetAddQuotes 0
'Individual window settings (different for each running instance) -------------
IF ReadConfigSetting(windowSettingsSection$, "IDE_TopPosition", value$) THEN
IDE_TopPosition = VAL(value$)
ELSE
IDE_BypassAutoPosition = -1 'If there's no position saved in the file, then we certainly don't need to try and auto-position to our last setting.
IDE_TopPosition = 0
END IF
IF ReadConfigSetting(windowSettingsSection$, "IDE_LeftPosition", value$) THEN
IDE_LeftPosition = VAL(value$)
ELSE
IDE_BypassAutoPosition = -1 'If there's no position saved in the file, then we certainly don't need to try and auto-position to our last setting.
IDE_LeftPosition = 0
END IF
result = ReadConfigSetting(windowSettingsSection$, "IDE_Width", value$)
idewx = VAL(value$)
IF idewx < 80 OR idewx > 1000 THEN idewx = 80: WriteConfigSetting windowSettingsSection$, "IDE_Width", "80"
result = ReadConfigSetting(windowSettingsSection$, "IDE_Height", value$)
idewy = VAL(value$)
IF idewy < 25 OR idewy > 1000 THEN idewy = 25: WriteConfigSetting windowSettingsSection$, "IDE_Height", "25"
'Color settings ---------------------------------------------------------------
'Defaults: (= Super Dark Blue scheme, as of v1.5)
IDETextColor = _RGB32(216, 216, 216)
IDEKeywordColor = _RGB32(69, 118, 147)
@ -450,50 +495,5 @@ IF ReadConfigSetting(colorSettingsSection$, "BackgroundColor2", value$) THEN
ELSE WriteConfigSetting colorSettingsSection$, "BackgroundColor2", rgbs$(IDEBackgroundColor2)
END IF
'Custom keywords --------------------------------------------------------------
IF ReadConfigSetting(customDictionarySection$, "CustomKeywords$", value$) THEN
tempList$ = ""
listOfCustomKeywords$ = "@" + UCASE$(value$) + "@"
FOR I = 1 TO LEN(listOfCustomKeywords$)
checkChar = ASC(listOfCustomKeywords$, I)
IF checkChar = 64 THEN
IF RIGHT$(tempList$, 1) <> "@" THEN tempList$ = tempList$ + "@"
ELSE
tempList$ = tempList$ + CHR$(checkChar)
END IF
NEXT
listOfCustomKeywords$ = tempList$
customKeywordsLength = LEN(listOfCustomKeywords$)
ELSE
IniSetAddQuotes -1
WriteConfigSetting customDictionarySection$, "Instructions1", "Add custom keywords separated by the 'at' sign."
WriteConfigSetting customDictionarySection$, "Instructions2", "Useful to colorize constants (eg @true@false@)."
IniSetAddQuotes 0
WriteConfigSetting customDictionarySection$, "CustomKeywords$", "@"
END IF
'Individual window settings (different for each running instance) -------------
IF ReadConfigSetting(windowSettingsSection$ + iniFolderIndex$, "IDE_TopPosition", value$) THEN
IDE_TopPosition = VAL(value$)
ELSE
IDE_BypassAutoPosition = -1 'If there's no position saved in the file, then we certainly don't need to try and auto-position to our last setting.
IDE_TopPosition = 0
END IF
IF ReadConfigSetting(windowSettingsSection$ + iniFolderIndex$, "IDE_LeftPosition", value$) THEN
IDE_LeftPosition = VAL(value$)
ELSE
IDE_BypassAutoPosition = -1 'If there's no position saved in the file, then we certainly don't need to try and auto-position to our last setting.
IDE_LeftPosition = 0
END IF
result = ReadConfigSetting(windowSettingsSection$ + iniFolderIndex$, "IDE_Width", value$)
idewx = VAL(value$)
IF idewx < 80 OR idewx > 1000 THEN idewx = 80: WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_Width", "80"
result = ReadConfigSetting(windowSettingsSection$ + iniFolderIndex$, "IDE_Height", value$)
idewy = VAL(value$)
IF idewy < 25 OR idewy > 1000 THEN idewy = 25: WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_Height", "25"
'End of initial settings ------------------------------------------------------

View file

@ -960,8 +960,8 @@ FUNCTION ide2 (ignore)
LOOP WHILE _RESIZE
IF retval = 1 THEN 'screen dimensions have changed and everything must be redrawn/reapplied
WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_Width", STR$(idewx)
WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_Height", STR$(idewy)
WriteConfigSetting windowSettingsSection$, "IDE_Width", STR$(idewx)
WriteConfigSetting windowSettingsSection$, "IDE_Height", STR$(idewy)
END IF
retval = 1
@ -1333,8 +1333,8 @@ FUNCTION ide2 (ignore)
IF IDE_AutoPosition THEN
IF IDE_TopPosition <> _SCREENY OR IDE_LeftPosition <> _SCREENX THEN
IF _SCREENY >= -_HEIGHT * _FONTHEIGHT AND _SCREENX >= -_WIDTH * _FONTWIDTH THEN 'Don't record the position if it's off the screen, past the point where we can drag it back into a different position.
WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_TopPosition", STR$(_SCREENY)
WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_LeftPosition", STR$(_SCREENX)
WriteConfigSetting windowSettingsSection$, "IDE_TopPosition", STR$(_SCREENY)
WriteConfigSetting windowSettingsSection$, "IDE_LeftPosition", STR$(_SCREENX)
IDE_TopPosition = _SCREENY: IDE_LeftPosition = _SCREENX
END IF
END IF
@ -14981,8 +14981,8 @@ FUNCTION idedisplaybox
idecustomfontheight = v%
WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_Width", STR$(idewx)
WriteConfigSetting windowSettingsSection$ + iniFolderIndex$, "IDE_Height", STR$(idewy)
WriteConfigSetting windowSettingsSection$, "IDE_Width", STR$(idewx)
WriteConfigSetting windowSettingsSection$, "IDE_Height", STR$(idewy)
IF idecustomfont THEN
WriteConfigSetting displaySettingsSection$, "IDE_CustomFont", "True"
ELSE