feat: convert bookmarks to tags with color highlighting#1296
Conversation
76067f8 to
d6586a8
Compare
|
I will be looking at this closely in a few days. As I've mentioned, I'm traveling for work this week and have little spare time until I'm home again. |
d6586a8 to
2d28e80
Compare
|
One immediate observation: |
2c7c9dd to
d25230f
Compare
|
I need help for Windows, i'm becoming crasy. It's all the more frustrating because these new tags look great on Ubuntu! See what Claude says: [Windows build] win64: missing webkitgtk-3.0 for mingw64, and folder/edit bookmark dialogs not working Context: Problem 1 — win64 build fails: We tried Question: What is the recommended way to build win64 with GTK3 without webkit? Is there a mingw64 webkit package available, or should we protect all Problem 2 — folder/edit bookmark dialogs do nothing on Windows: if (NOT GTK2)
install (FILES folder.gtkbuilder ... languages ...)This is directly tied to Problem 1 — fixing the win64 GTK3 build would resolve both issues. |
d25230f to
592ae88
Compare
|
Ok, some updates. I got the build working on Windows, and I got the languages working too (no more unknown)! Thank God (and Gemini for this time). The bookmarks work almost:
I imagine the problem lies in folder.glade. If anyone is willing to help me finish the job, that would be great. |
5031f73 to
c4a4212
Compare
|
I'm happy to announce that it works! Please try it out for yourselves. Now I can create folders on windows, and the colors are applied to the verses. The color appear in front of the tag like it does in Linux. |
95ca928 to
a29c4b8
Compare
|
I'm really flattered that you're asking me—a total newbie who doesn't know anything about this—how to get my branch! But I pushed the branch to my personal fork and opened a Pull Request for it. You can see all the code changes directly here in the PR: PR 1296 If you want to pull my branch locally to test the code, you can fetch it directly from the PR using this command (you probably know this, but I say it anyways!!): (Or if you use GitHub CLI: The branch in my fork: https://github.com/LAfricain/xiphos/tree/refs/heads/bookmarks2tags If I need to do anything else, let me know. |
|
@karlkleinpaste did you found a way to my branch? |
- Add COL_COLOR column to bookmark tree store (bookmarks_treeview.h/c) - Add color attribute to XML folder nodes (xml.c/h) - New folder dialog with color picker (ui/folder.gtkbuilder, ui/folder.glade) - Tag color saved and restored from bookmarks.xml - Verse highlighting in Bible text using tag color (display.cc) - Text color auto-adjusted for dark backgrounds (luminance) - Multi-reference support: semicolons, commas, verse ranges - Popup menu for multi-reference bookmarks navigation - Drag and drop reordering enabled by default - Cairo color dot in treeview for tagged folders - Current verse green highlight disabled when tag color present - Fix bookmark folder labels localization: gettext now initialized before default bookmarks are created, so folder names (Personal, What must I do to be saved?, etc.) are properly translated on first run Closes crosswire#968 Closes crosswire#685
|
I had not found opportunity to look at this in the last week, though I did take care of the ReadAloud PR and made a couple updates past it. ReadAloud from mouse selection now works properly ... in Linux. The builds fail in Windows. I was also not aware of the means to get at another's private branch until you mentioned it -- I am not a heavy user of GH and freely admit to being ignorant of many of its capabilities. I see you've just pushed an update. I gather from this push that you must have rebased to master; true? Then you'll see that the Windows build problems need to be handled. At first glance from the failed log, I think there is just some *.h file in need of being included, so as to properly declare a series of required functions, but I am not sure. I know very little of these Windows interfaces. |
|
The crash occurs specifically when using right-click on Bible text → Add bookmark, but not when using the bookmark panel directly. The backtrace pointed to After analysis, the root cause is in // BEFORE — uninitialized memory, data->color is never assigned
data = g_new(BOOKMARK_DATA, 1);
...
// data->color is never set → random garbage value
The other path ( The probable fix: // AFTER — zero-initialized, data->color is NULL by default
data = g_new0(BOOKMARK_DATA, 1);
...
data->color = NULL; /* bookmark leaves never have a color */This works on Linux by luck — the kernel tends to return zeroed pages, so But the Windows build failure on
This PR only modifies @karlkleinpaste, can you have a look about the CI? |
|
Oops, our messages crossed paths—almost at the exact same moment! |
|
You're asking a lot. I'm not kidding. The problem presented by your (Claude's?) new TTS code for Windows is that it's trying to use C++ in a C environment. When I ask the AI for suggestions, it says bluntly, "Disable TTS for Windows build" with assorted I said I know next to nothing about Windows interfaces like this. I Don't Do Windows. |
|
I just disabled Windows TTS entirely for the moment. Oh for pity's sake. The entire Windows speech re-work has been very poorly prepared. |
|
All right... Windows TTS is disabled and Windows builds succeed. |
|
@karlkleinpaste Sorry for asking so much—to be honest, I don't always realize it! Sorry also for the poor work on the TTS issue; I didn't do it with Claude but with DS and Gemini. Their level is nowhere near Claude's. |
|
Success! xiphos-4.3.2.56-win64.exe: Can add bookmarks without crash. |
|
😊 😊 😊 😊 |
|
Never mind. Old instance running where I thought I had restarted it. Got it now. |
|
I just realized after the fact that my example bookmark above that begins "Matthew 15:6" did not dump the entire set of verses into the verse list. It dumped only 3. I will be reverting this PR momentarily. |
This reverts commit efbd7be.
|
All these issues you're having are really strange. It sounds more like a failed migration. I didn't have any tags before, and I'm not experiencing any of the problems you're describing. The colors are displaying correctly. And under Wine too, based on the quick tests I just ran. |
|
I added your entry to my bookmarks and I'm having the same problem as you. It's true that I was tempted to do it differently. I create a folder with a theme and a color, then add my bookmarks to it one by one as I go. |
|
For the moment, I suggest re-introduction of the code in some piecemeal fashion, ensuring that all of it is in place exactly as intended. The chapter excess colorization rendering is most concerning, as is the new UI interpretation of clicking a multi-verse bookmark. A multi-verse bookmark should have its contents dumped into the verse list, period -- no change from ordinary behavior up to now. To turn that into a pulldown means there's a lot of code in there to handle that deliberately. That's not a mistake and it's not a migration error, that's a considered, deliberate change. And to have a multi-verse bookmark cut short when dumped into the verse list is plain wrong -- getting that wrong means that the handling of the expansion of the textual content of the bookmark into a bookmark list (internally, a "GList *" set) was badly damaged. |
|
Can you send me a copy of your bookmarks file? I'd like to try migrating with them on Monday. The weird thing is that if I create a label with a title and add your references to it, everything works perfectly! The references open in the context menu, and the verses are displayed in the correct colors... |
|
Karl, you sound angry. And I don't think that's justified. We're all doing the best we can :)
I think you’re overreacting here. It’s really weird to click on a bookmark and—poof—it opens in another tab, and then you have to go back to the other tab. I’m the one who wanted this behavior because I find it more consistent (and I think I described it). Is it at least possible to discuss this? |
|
Dear Karl, Now, about the context menu for the verses. I understand that you don’t see things the same way I do. And it’s up to you. I’m willing to do sacrifice this feature. But please think it over first. A context menu that pops up is super convenient; it saves you from clicking all over the place to open a reference (without the context menu, you might end up constantly switching between different windows). With the context menu, you have everything right at your fingertips, so to speak. But anyway, I see that the context menu doesn’t always work. When there are ranges in the references, it opens everything in the verse window. I probably have the solution, but it all depends on what you decide. |






Voici le texte de la PR :
Title: feat: Convert bookmarks to tags with color highlighting
Closes: #968, #685
Summary
This PR converts the existing Bookmarks tab into a Tags system. Tags are a strict superset of bookmarks: every bookmark can be expressed as a tag entry belonging to a named, color-coded folder. This approach resolves both #968 (tags in text) and #685 (color for bookmark folders) in a single coherent feature.
Changes
Data model
COL_COLORcolumn (G_TYPE_STRING) to theGtkTreeStorecolorattribute on<Folder>nodes — fully backward compatible (existing files load without modification)xml_add_folder_to_parent_colored()andxml_get_folder_color()toxml.c/hUI — Tag panel
ui/folder.gtkbuilder(andfolder.gladefor Windows) with a name field, aGtkColorButton, and a "No color" buttonVerse highlighting in the Bible text view
get_tag_color_for_versekey()indisplay.ccwalks theGtkTreeStoreand returns the tag color for the current verse usingVerseKeyOSIS normalization — this handles locale differences between the stored key format and the display engine formatcolor:computed from background luminance (ITU-R BT.709) so text remains readable on dark tag colorsAct 16:31; 16:36): book name is propagated to partial refsEph 2:8,9): expanded to individual verse checks1 Cor 15:1-4): checked numerically (book + chapter + verse range) to avoid lexicographic comparison bugsDesign decisions
Why disable the current-verse green highlight when a tag color is present?
When a verse has a tag color, the green highlight from
settings.versehighlightwould override or mix with the tag color, making the tag color invisible on the current verse. We chose to skip the green highlight whentag_color != NULL, so the tag color takes full visual priority. The user can still see which verse is current via the verse number anchor.Why use
VerseKeynormalization instead of string comparison?Stored bookmark keys use locale-dependent formats (e.g.
"Actes 16:31"in French) whileGTKChapDisp::display()iterates using English OSIS book names ("Act"). Direct string comparison always fails across locales. Normalizing both sides throughVerseKey::getOSISBookName()+ chapter + verse gives a locale-independent comparison.Why use numeric comparison for verse ranges instead of OSIS string comparison?
Lexicographic comparison of OSIS refs like
"1Co.15.10"vs"1Co.15.4"gives wrong results ("10" < "4"alphabetically). We comparevk->getVerse()directly againstvk_start.getVerse()andatoi(dash + 1)as integers.Why move the color picker out of the context menu?
The context menu item "Set folder color" required a two-step interaction (right-click → menu item → color dialog) and did not work on empty folders. Integrating the color picker directly into the "New Folder" and "Edit Item" dialogs makes it discoverable and works consistently regardless of folder contents.
Localization fix
Default bookmark folder names (
Personal,What must I do to be saved?, etc.) were always created in English becausexml_new_bookmark_file()was called beforegui_init()initialized gettext. Fixed by callinggui_init()beforeinit_bookmarks()insettings.c.gui_init()is idempotent (guarded by a static flag) so multiple calls are safe.Backward compatibility
bookmarks.xmlfiles load without modification — folders without acolorattribute simply have no tag colorbookmarks.xml.bakbackup is created on first run after upgrade (copied, not moved)Files changed
src/gtk/bookmark_dialog.c— new folder dialog, fixed button handlingsrc/gtk/bookmarks_menu.c— color-aware save, new/edit folder dialogssrc/gtk/bookmarks_treeview.c— COL_COLOR, Cairo dot, multi-ref navigation, drag & dropsrc/gtk/utilities.c—utilities_parse_treeviewpropagates colorsrc/gui/bookmarks_menu.h—set_colorwidget,on_set_tag_color_activatesrc/gui/bookmarks_treeview.h—COL_COLORenum,colorfield inBOOKMARK_DATAsrc/main/display.cc— tag color lookup, highlighting, luminance-based text colorsrc/main/main.c— backup on first runsrc/main/settings.c—gui_initbeforeinit_bookmarkssrc/main/xml.c/h—xml_add_folder_to_parent_colored,xml_get_folder_colorui/CMakeLists.txt— addedfolder.gtkbuilderandfolder.gladeui/folder.gtkbuilder/ui/folder.glade— new folder dialog UIPlease test!