|
|
#46 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,047
Karma: 3883259
Join Date: Jan 2017
Location: Poland
Device: Various
|
For Windows:
1. delete .qmake.stash 2. in file "SelectCharacter.cpp" in line 111 set path to file "characters.txt". Notice: use double backslashes, eg. QString custom_path = "W:\\Develop\\special_char\\characters.txt"; 3. run console (x64 Native Tools Command Prompt for VS) 4. run qmake (will create new .qmake.stash file) 5. run nmake and wait (remember: NMAKE) 6. in subfolder "release" should be "flowlayout.exe" file 7. run this exe file It works, and overall it's OK. This is exactly the effect I was going for – wrapping the characters to fit the width of the window while keeping the groups fixed. I'd probably condense the spacing between the groups a bit, but that's just an aesthetic detail. Last edited by BeckyEbook; 09-17-2026 at 02:48 PM. |
|
|
|
|
|
#47 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,070
Karma: 7518950
Join Date: Nov 2009
Device: many
|
Yes the spacing between groups by default is 0 since the linebreak is really an invisible QWidget and without layout spacing/margins there is no gap at all.
So I hardcoded an additional height of 15 in the dolayout routine in FlowLayout.cpp. Just look for the "if" that isLineBreak and tweak what gets added to y height. The problem with a flowlayout is that two back to back linebreaks adds no intergroup spacing at all without that hard coded addition. I thought the make distclean removed the qmake stash. And yes, fix the path to characters.txt in SelectCharacter.cpp not windows.cpp. My bad! Thanks for getting it working on Windows. Please make what tweaks you want and then I will start the conversion to xml. Thanks Kevin Last edited by KevinH; 09-17-2026 at 03:06 PM. |
|
|
|
|
|
#48 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,047
Karma: 3883259
Join Date: Jan 2017
Location: Poland
Device: Various
|
I think it's enough to remove the extra "+15" from the height, since the groups already clearly separate the blocks. I've been experimenting with making the group names bold, and I think that's worth considering as well.
Code:
y = y + lineHeight + verticalSpacing(); Code:
QLabel* lbl = new QLabel(insert_text);
QFont labelFont = lbl->font();
labelFont.setBold(true);
lbl->setFont(labelFont);
|
|
|
|
|
|
#49 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,047
Karma: 3883259
Join Date: Jan 2017
Location: Poland
Device: Various
|
Maybe we could also include the color in the group name? I have to admit that in my mind, this window looked very similar.
|
|
|
|
|
|
#50 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,070
Karma: 7518950
Join Date: Nov 2009
Device: many
|
Without that 15 added in there is no spacing at all between the groups on MacOS, so we will need to do something platform specific here. Literally, the top of the heading touches the bottom of the preceding line text.
Let's worry about heading colours at some later point. Hard coding colours to work in all platforms under both dark and light is hard especially on Linux. Those types of tweaks can come later. Functionally, is this proof of concept working enough to go ahead and convert it to xml? Last edited by KevinH; 09-17-2026 at 06:26 PM. |
|
|
|
|
|
#51 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 54,523
Karma: 182340323
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Other than the joy of figuring out that I misspelled QT_PLUGIN_PATH (you don't spell plugin with two g's?), it looks good here. I added my personal selection as another group and continued looking good.
|
|
|
|
|
|
#52 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,047
Karma: 3883259
Join Date: Jan 2017
Location: Poland
Device: Various
|
Yes, OK for me.
|
|
|
|
|
|
#53 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,769
Karma: 212614993
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Remember that qss has a palette() function that takes Qt's color roles as a parameter. No need to hardcode a single color that has to work with all platforms/all themes.
|
|
|
|
|
|
#54 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,070
Karma: 7518950
Join Date: Nov 2009
Device: many
|
Okay, I have modified the FlowLayout to have its own addLineBreak() routine to better encapsulate that code and remove SelectCharacter's GenFlowLineBreak routine. Then I modified the FlowLayout code to be smarter about vertical spacing for all platforms including the Mac, and removed the hard coded + 15.
I am finally seeing on the Mac something much closer to what BeckEbook's images show. I will now start the process of converting it to xml, next. |
|
|
|
|
|
#55 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,070
Karma: 7518950
Join Date: Nov 2009
Device: many
|
Been tied up with bug fixes for AdjustImage and so just started looking at this now.
I would like to keep the 4 internal strings for each special char, but it would be nice to simplify what gets read in from special_characters.xml and auto generate things we can. so instead of trying to use what we have now but in xml format: Code:
<char str=" " label="nbsp" entity="  ;" desc="non-breaking space" /> I would like to simplify this to the following: Code:
<cp hex="A0" label="nbsp" desc="non-breaking space" /> Also any group headings are also considered to be in the users language as well. Thoughts? Last edited by KevinH; Yesterday at 02:41 PM. |
|
|
|
|
|
#56 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,047
Karma: 3883259
Join Date: Jan 2017
Location: Poland
Device: Various
|
That's fine with me.
|
|
|
|
|
|
#57 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,070
Karma: 7518950
Join Date: Nov 2009
Device: many
|
Okay, I took a quick and dirty approach to reading in and using a special_characters.xml file.
This is just for proof of concept and so that you can see and work with the xml format. It needs to be greatly cleaned up. To help speed things up, I have included a cvrt.py python program that will read in local characters.txt and create a local special_characters.xml file. I just threw the cvrt.py together so no nasty comments about crap python code! ![]() I have improved the FlowLayout code to not need the extra macOS + 15 offset. It should use qmake and make / nmake. I have attached the new special_char.zip file with all changes. Please play around with the new xml code format and let me know what you think. Right now if it is not well formed, QXmlStreamReader will fail and a debug message is written out as qDebug. So you can turn on debug log files and capture any xml error. We can make this easier to do in the future. Any failure in load results in the old grid layout being used instead. Just like any other xml it is very picky. Check out cvrt.py to see how it was auto generated. Last edited by KevinH; Yesterday at 06:21 PM. |
|
|
|
|
|
#58 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,070
Karma: 7518950
Join Date: Nov 2009
Device: many
|
Because file formats change over time. We should probably add a version= attribute to the starting parent specialchars tag, then we can use its value to handle parsing changes in a backwards compatible way.
|
|
|
|
|
|
#59 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,070
Karma: 7518950
Join Date: Nov 2009
Device: many
|
If anyone plays around with this xml version, please let me know your thoughts. If okay, I will work to cleanup all the code and integrate it into the version of SelectCharacter.cpp actually used inside Sigil and commit it to my personal repo until everyone is happy.
|
|
|
|
|
|
#60 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,047
Karma: 3883259
Join Date: Jan 2017
Location: Poland
Device: Various
|
As far as I'm concerned, the proposed XML format is fine.
I just removed the empty label="" – why make the file unnecessarily larger? Besides, XML prefers minimalism. |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PageEdit 2.1.0 - Insert Special Character not working | BetterRed | Sigil | 0 | 05-17-2024 10:01 PM |
| Add title="" to h* based on existing TOC -- suggestion for new feature (or plugin?) | Mister L | Sigil | 82 | 09-11-2020 09:09 AM |
| "insert special character" in editor | rjwse@aol.com | Editor | 5 | 08-27-2019 08:31 PM |
| Insert special character: some niggles | Phssthpok | Editor | 2 | 11-19-2016 12:55 PM |
| Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" | therealjoeblow | Calibre | 15 | 07-25-2011 03:14 PM |