Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General ide refactoring #519

Merged
merged 14 commits into from
Jul 17, 2024
Merged

General ide refactoring #519

merged 14 commits into from
Jul 17, 2024

Conversation

RhoSigma-QB64
Copy link
Member

  • fixed some longstanding issues, such as changing settings in the Options Menu caused your code be marked as "changed"

  • move IDE related config and workfiles out of internal/temp into settings directly under the qb64pe folder
    • note this folder is not maintained in the repo, but created on the first IDE run, the user has a choice to copy his settings from another QB64-PE installation or to continue with default settings
  • the recent files and search string histories are globally shared now by all running IDE instances
    • use the new Undo/History... dialog (Options Menu) to set the desired history limits
    • if one instance makes changes to such a history, then the new/changed entries will be immediately available in all other instances
  • bookmarks behavior remains unchanged, those are saved/restored globally connected to the respective basic source files
  • undo behavior remains unchanged and is managed per instance

  • as a side change I've added 4 new preset color schemes, Cornfield, Broadcast, X11 SgiColors by me and VS Code curtesy to @a740g

- correct wrong information
- fix typos and capitalize keywords
- comment unused code
- added 4 new schemes
- established somewhat of a logic order
- moved converter function from file.bas to qb64pe.bas, as it's rather compiler related than a common file function
- also fixed several "change state" related bugs (i.e. switching certain settings in the Options Menu will no longer mark the current code as "changed")
- using the new _READFILE$ and _WRITEFILE commands where applicable
- moved error handler changes inside CopyFile&() so we don't need to remember to do this before calling the function
  - fixed file tests complaining about missing error handlers
- fixed spacing calculation for action buttons (wrong string tested, dates back to SDL age, unbelievable nobody before recognized the spacing was wrong)
- in messagebox raise max. lines (needed later)
- also move bound check before index increment, formerly the index was incremented once more which lead to a subscript out of range later in the function
- some fixes according to the things I've learned now about the IDE dialogs
- the old Backup/Undo limit dialog was replaced by the new Undo/History limits dialog, which also allows to set the limits for Recent files and Search history
- add new requirements, and remove no longer used code
- IDEsettings.bas cannot longer used, it's split into the usual global/methods pair and saved in source/ide/config
- new $INCLUDE lines in qb64pe.bas
- moved wiki methods $INCLUDE to a more appropriate place in ide_methods.bas
- autosave.bin doesn't need to be opened and read anymore, instead it's mere existence flags the availability of a restorable backup
- all files maintained in qb64pe/settings now and addressed using file name variables instead of hardcoded names
- maintain recent/search histories according to the limits set in Options>Undo/History... dialog (saved in config.ini)
- update recent files in the File Menu only when needed (i.e. right before the menu is displayed) rather than on every change to the history
- ask user to import config files from another QB64-PE installation (triggered by absence of the settings folder, i.e. on a new installed release as we don't maintain the folder in the repo)
- simplified the other 1st time messages (use \n instead of the bulky +CHR$(10)), the messagebox function understands \n
@RhoSigma-QB64 RhoSigma-QB64 added the enhancement New feature or request label Jul 15, 2024
@RhoSigma-QB64 RhoSigma-QB64 self-assigned this Jul 15, 2024
Copy link
Contributor

@a740g a740g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add settings to .gitignore. Other than that, this looks good to me. 👍

- fixed/added custom font error checking on IDE startup and in Options>Display... dialog
- added new settings folder to .gitignore list
IF idecustomfonthandle = -1 THEN
'failed! - revert to default settings
IF idecustomfonthandle < 1 THEN
retval = idemessagebox("Custom font not found!", "Your desired font was not found at the specified location, or is\nof unsupported format. Reverting back to default built-in font.", "#OK")
idecustomfont = 0: idecustomfontfile$ = "C:\Windows\Fonts\lucon.ttf": idecustomfontheight = 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change

idecustomfontfile$ = "C:\Windows\Fonts\lucon.ttf"

to

idecustomfontfile$ = _DIR$("fonts") + "lucon.ttf"

That way it will point to the correct Windows directory (whichever drive / directory it is installed in).

As a bonus, we can also make this cross-platform by replacing 'lucon.ttf" with a font that is available on other platforms.

IF INSTR(_OS$, "[MACOSX]") THEN
    idecustomfontfile$ = _DIR$("fonts") + "Courier New.ttf"
ELSEIF INSTR(_OS$, "[LINUX]") THEN
    idecustomfontfile$ = _DIR$("fonts") + "truetype/liberation/LiberationMono-Regular.ttf"
ELSE
    idecustomfontfile$ = _DIR$("fonts") + "lucon.ttf"
END IF

@@ -1385,7 +1385,7 @@ id.args = 4
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.specialformat = "?,?[,[?][,[?]]]"
id.ret = LONGTYPE - ISPOINTER
id.hr_syntax = "_LOADFONT(fileName$, size&[, " + CHR$(34) + "{MONOSPACE|, UNICODE|, DONTBLEND|, MEMORY}" + CHR$(34) + "][, fontIndex])"
id.hr_syntax = "_LOADFONT(fileName$, size&[, " + CHR$(34) + "{MONOSPACE|, UNICODE|, DONTBLEND|, MEMORY|, AUTOMONO}" + CHR$(34) + "][, fontIndex])"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 😁

- preset default custom fonts by platform, not all have lucon.ttf available
@RhoSigma-QB64 RhoSigma-QB64 merged commit 7d47079 into main Jul 17, 2024
4 checks passed
@RhoSigma-QB64 RhoSigma-QB64 deleted the general-ide-refactoring branch July 17, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

3 participants