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

[Documentation] Synchronize code and docs of test/editor.cxx #189

Closed
Albrecht-S opened this issue Feb 15, 2021 · 6 comments
Closed

[Documentation] Synchronize code and docs of test/editor.cxx #189

Albrecht-S opened this issue Feb 15, 2021 · 6 comments
Assignees
Labels
documentation Needs better documentation fixed The issue or PR was fixed.

Comments

@Albrecht-S
Copy link
Member

I wrote in this comment on issue #135:

The docs in chapter "Designing a Simple Text Editor" show in paragraph "Syntax Highlighting" much code including the entire style_parse() function. This code has obviously not been updated regularly, there are some parts missing/incomplete/outdated.
... we should synchronize the code and the docs at some time. I'm also not sure if it's useful to add the entire new functionality to the editor demo. Maybe it would be a compromise to

  • do only a small fix but not to update the entire code or
  • remove the function from the docs and refer to the real code in the source distro and
  • fix the syntax highlighting code by adding separate files/functions that can be shared with fluid

or something like that. In the simplest case we'd just document that the documentation is incomplete and that the real code in the source distro should be consulted (to avoid too much code duplication in the docs).
[End of citation].

The mentioned "new functionality" refers to the new style_parse() function in a separate file in fluid.

I'm opening this issue and classifying it as "Documentation" as a reminder that this should be done. It's low priority but since the editor code is documented it should be synchronized in one way or the other.

@erco77
Copy link
Contributor

erco77 commented Feb 15, 2021

My suggestion would be to redefine the editor demo to not be a code highlighter (which is hard), but something more simple and practical.

Perhaps ^F search could highlight all matches in the file instead of just one word at a time, highlighting the 'current'
word in a different color from the other matches.

I think all people want to see is how highlighting works, and not be distracted by lots of syntax parsing code.

@rempas
Copy link

rempas commented Apr 14, 2021

First of all I would like to thank you for your work on FLTK. I finally found the GUI library that I want to use and I hope I can also contribute to the project in the future If I properly learn C++ and when I feel ready to!

I have 2 suggestions for the doc example.

  1. Implement the missing callback functions. These are insert_cb | view_cb | close_cb | undo_cb.
  2. Change the example a little bit, split it to files. I personally made a header file for the commons includes and for the global variables, a file for the main(), a file for the menu bar, a file for the EditorWindow, a file for the callbacks and a file for the other functions. And of course an associative header file for each one of them (except for the one in the main). Also I would be nice to use #pragma once as we are writing C++. Even if you don't do that, PLEASE PLEASE PLEASE, make this more clear!! I wasn't able to finish the project because I can't properly implement some stuff. For example:
l_Menu_Bar*m = new Fl_Menu_Bar(0, 0, 640, 30);
m->copy(menuitems);

where should I create that? Inside the class constructor or inside the main? It's not clear and I don't know if I'm just a beginner and I should have figured that out be myself... Or:

w->editor = new Fl_Text_Editor(0, 30, 640, 370);. What is w? I suppose it's a variable of type EditorWindow but when it was created?
Please do not suppose that we know how to do that, for noobies like me, It's not the best thing.

Again I hope I could help a bit!

@MatthiasWM MatthiasWM self-assigned this Aug 3, 2023
@MatthiasWM
Copy link
Contributor

I am sorry that I am so late to this, and will probably still take some time until I have something useful. I agree that writing a text parser should not be part of the tutorial. I am more thinking about a boilerplate start, adding feature by feature, and, as @rempas said, making it clear where the code goes. Also, a copy of the C text parser is part of FLUID. No real reason to repeat that here.

@MatthiasWM MatthiasWM added this to the Release FLTK 1.4.0 milestone Dec 6, 2023
@Albrecht-S Albrecht-S removed this from the Release FLTK 1.4.0 milestone Jan 1, 2024
@Albrecht-S
Copy link
Member Author

@MatthiasWM Please feel free to work on this but I removed this issue from the 1.4.0 milestone because it's not important enough to hold the release.

@MatthiasWM
Copy link
Contributor

See #883

@MatthiasWM MatthiasWM added waiting for confirmation waiting for someone's confirmation fixed The issue or PR was fixed. and removed ☃️ not in 1.4.0 labels Jan 28, 2024
MatthiasWM added a commit that referenced this issue Jan 29, 2024
Update test/editor code and tutorial (#189, #883)

Different, sequential approach to Editor tutorial
Co-authored-by: Albrecht Schlosser <albrechts.fltk@online.de>
@MatthiasWM
Copy link
Contributor

PR #883 merged.

@Albrecht-S Albrecht-S removed the waiting for confirmation waiting for someone's confirmation label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Needs better documentation fixed The issue or PR was fixed.
Projects
None yet
Development

No branches or pull requests

4 participants